Mentions légales du service

Skip to content

Aseba does not accept 'for' iteration on an array

Created by: severin-lemaignan

The following code:

var ledsrow[4]

onevent setLedsRow
ledsrow = [[0, 5], [6, 11]]
for i in ledsrow[event.args[0] * 2]:ledsrow[event.args[0] * 2 + 1] do
    call led.set(i, event.args[1], event.args[2], event.args[3])        
end

does not compile with the message: Error at line ...: constant ledrows not defined

It seems like a bug to me because:

  • ledrows is not declared as a constant
  • I can not see any obvious error in my code (note that I'm a total beginner with the Aseba language, so I may miss something stupid), which let me think that for can not take its bounds from an array (??), which is not mention in the documentation

Note that the exact same issue occur if I define ledsrow as ledsrow = [0, 5, 6, 11].