This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Randomrdp's profile picture

code fail: bios:206:[string "mine"] :21: 'end' expected (to close 'if' at line 17)

Started by Randomrdp, 26 September 2012 - 07:55 PM
Randomrdp #1
Posted 26 September 2012 - 09:55 PM
hi
I'm trying to write a program the mines a 7x13 area and it's not working and i can't see what i'm doing wrong. Please Help.

y=7
repeat
x=13
repeat // moves forward 13
turtle.dig()
turtle.forward()
x=x-1
until x<1
rol=y
if math.mod(rol, 2) == 0 then rol=l //test if left or right turn
else
rol=r
if rol==r then turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
if rol==r then turtle.turnRight()
else
turtle.turnLeft()
y=y-1
until y<1
end
the error message I get is:

bios:206:[string "mine"] :21:
'end' expected (to close 'if' at
line 17)


Please Help

EDIT:above fixed but a new problem has occurred


y=7
repeat
x=13
repeat // moves forward 13
turtle.dig()
turtle.forward()
x=x-1
until x<1
rol=y
if math.mod(rol, 2) == 0 then rol=l //test if left or right turn
else
rol=r
end
if rol==r then turtle.turnRight()
else
turtle.turnLeft()
end
turtle.forward()
if rol==r then turtle.turnRight()
else
turtle.turnLeft()
end
y=y-1
until y<1
end

bios:206 [string "mine"]:25:
'<eof>' expected

again please help, I am sorry for my stupidity
Noodle #2
Posted 26 September 2012 - 10:06 PM
if rol == r then
EDIT: // IS NOT A COMMENT
'–' is!
Mr. Fang #3
Posted 27 September 2012 - 03:41 PM
If that's not all I suggest adding an "end" at some point to stop the cycle.
Randomrdp #4
Posted 27 September 2012 - 04:07 PM
I guessed that // was the comment because thats what it is in java, pascal and probably lots more languages as well
jag #5
Posted 27 September 2012 - 06:46 PM
I guessed that // was the comment because thats what it is in java, pascal and probably lots more languages as well
Well yeah, when switching between different coding languages when there's a small change (like how a comment work) there's always a problem…
Randomrdp #6
Posted 27 September 2012 - 07:52 PM
thats cool
DFTBA