For Loop Resource Help

expresscourse
forloop

#1

I could use some extra help understanding for loops in Bee and For Loops in Artist. Just when I think I understand how the for loop works the puzzle changes. I do not understand how to determine the counter variable with a math block when the flowers have multiple nectar drops to collect.
Is there a checklist I can use to determine how to write the parts of the for loop? Is there a resource that could help me better understand for loops in blocks?


#2

Sorry for the delay in getting back to you on this. I didn’t see it.

For loops are structures where you get to determine the start, stop, and step for the loop. A great way to see what each does is to run through ‘For Loop Fun’ located here:

https://curriculum.code.org/csf-18/express/32/

Think of the counter as a little number-keeper that holds the value set by the for loop each time through. You can pretend it’s like an odometer that starts at your starting value and increases by the step value each time you go through the loop. Your loop exits once the odometer gets to the stop value.

As an example, you could do a puzzle like this one of 2 ways:

15 12 9 6 3

Either you can start at 15, stop after 3 and decrease by 3 each time through the loop and use the value of the counter as the number of nectars to collect (15-3=12, 12-3=9, etc.)

or

You can start at 5, stop at 1, decreasing by 1 each time and use the value of the counter*3 as the number of nectars to collect

I went looking for a helpful video and didn’t really see one…maybe I’ll have to make one!


#3

Thank you, very much!