Just started using CircuitBlocks on the Nibble with my 8 year old son and loving it. He even got a whole page in the school newsletter dedicated to it!
But I came across a bug in CircuitBlocks where it declares a global variable for “i” when generating a loop. This causes issues for nested loops because they also reference the same “i” variable. I was able to tell the nested loop to use a new variable (“j”), however, these loops should not have globally defined variables to begin with IMHO. It can cause a great deal of confusion for beginning programmers - and experienced ones too ;-). Can’t they be locally defined for the function they are in?
Thanks for bringing this to our attention. Feedback like this really helps the project!
Making the for-loop variables local seems like a nice improvement, and nested loops really should use a different variable by default.
I agree that it would definitely make things less confusing.
We’ll make sure to include these changes in the next CircuitBlocks update!
-Emil from CM