Of note is that this will automatically generate its own variable IDs. For your purposes this is probably fine, but for other purposes, you may want to specify the variable ID parameter. Likewise, this doesn't include variable types, but you could specify those by changing the
createVariables array to be an array of objects with the varName and varType (as well as varId if desired) and then just pass those into createVariable. Likewise, if you need access to those variables later, you can change the forEach loop to a map loop which returns the result of
createVariable and then use that array later. You can see more documentation on
createVariable here.
Depending on how you intend to set the variable values, you may need to get a bit creative when generating code to prevent the automatic variable definition at the top from occurring. If you're stuck on this step, let me know and I'll dig up an example of where we did just that in order to give you a pointer.