Jump to content




Basic "For" loops reporting errors


3 replies to this topic

#1 MrNorth

  • Members
  • 4 posts

Posted 26 July 2016 - 01:35 PM

Hello everyone. I'm totally new to forum posting, I'll do my best to make a comprehensible post.
As the title reads, I was fiddling around with CC 1.6 (btw, I'm new to programming) and I could not get a single "for" loop working.
Updated to 1.7 for Minecraft 1.7.10, nothing changed.

for i=1, 10, do
print(i)
end

The error message reads
bios:14:[string "Try"]:1: unexpected symbol

I cannot figure out what I'm doing wrong. Since I'm italian, could it be a keyboard issue? Don't know.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,452 posts

Posted 26 July 2016 - 01:37 PM

If you're not going to use the "step" feature, don't put a comma after the limit. The 2 here is the step:

i = 1, 19, 2 do


#3 The Logo Maker

  • Members
  • 83 posts
  • Locationyes

Posted 26 July 2016 - 03:04 PM

to further on from lyqyd moderator , to fix problem simple :

for i = 1, 10 do
    print(i)
end

Posted Image

#4 MrNorth

  • Members
  • 4 posts

Posted 28 July 2016 - 09:22 AM

As I supposed, it was just me being noob :D . thank you everyone





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users