First of all, this is in sugarcube.
I have a question:
Assuming I have an array,
Now, if you'll try this, you'll learn that this code does not work. The reason for this is that the variable $i contains the value of $myArray.length, since the for loop was concluded. That is to say, even though the following is printed:
Is there a workaround for this?
I have a question:
Assuming I have an array,
$myArray to [0, 1, 2, 3, 4, 5], and I want to display this as follows:
<<for $i to 0; $i < $myArray.length; $i++>> <<print $myArray[$i]>> [[Pick this element|nextPassage][$foo to $myArray[$i]]] <</for>>
Now, if you'll try this, you'll learn that this code does not work. The reason for this is that the variable $i contains the value of $myArray.length, since the for loop was concluded. That is to say, even though the following is printed:
No matter which element you pick, the value of $foo will always be 5.0
Pick this element
1
Pick this element
...
5
Pick this element
Is there a workaround for this?