Log In  

Can someone help me understand the For statement like I'm 5.

This is from the Squashy project in Picozine #1

-- draw the lives
for i=1,lives do
spr(000,90+i*8,4)
end

I understand what spr function is doing but in trying to use the for statement myself I run into a lot of errors.

P#18702 2016-02-07 14:34 ( Edited 2016-02-07 22:29)

for (Counting variable)=(Start),(End) do
spr(0,90+(Current Value of counting variable)*8,4)
end

P#18703 2016-02-07 15:10 ( Edited 2016-02-07 20:10)

Thanks. It looks for my purpose for will not be a proper statement to use.

P#18704 2016-02-07 15:20 ( Edited 2016-02-07 20:20)

There are while and repeat...until-loops as well, may be they suite you better.

P#18708 2016-02-07 17:29 ( Edited 2016-02-07 22:29)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-07-13 14:23 | 0.010s | 4194k | Q:15