repeat

repeat is a directive that can be added to any tag to repeat the object represented by that tag multiple times.

For example, to create a row of five cubes, instead of writing <cube/> five times, we write only one <cube/> and add repeat="5" to the tag.

repeat also allows us to iterate through an array using the expression:

repeat="variable_name in array"

For example, we add i in [1,2,3] to the cube tag and i becomes a variable we will have access to in the rest of the tag. Here, we give i as an argument to the transform command scale to scale each repeated instance of the cube by 1, 2, and 3 respectively.

For advanced users, it is possible to create an array in a script tag and make it available as a parameter in the repeat directive, rather than squeezing everything into the tag. Also, one can write custom Javascript code to generate the array.