Skip to content

in block coding how to use the count variable in a "repeat nn times" block? #1909

Answered by laurensvalk
BertLindeman asked this question in Q&A
Discussion options

You must be logged in to vote

In a "for item in range" block you can take the variable block and use it in the loop. In a "repeat xx times" block I see no way.

The repeat block is just a simpler variant of the "for item in range" block since not everyone is familiar with the latter. If you want a counter, use the item in range. That's why it is prepopulated with the range block already in it.

Slightly related: If I start with an empty list, how would I append elements to it in block coding?

The same as your existing sample above. Appending to an empty list is no different than appending to a list that already has items:

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@BertLindeman
Comment options

Answer selected by BertLindeman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants