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

Simple Code:Syntax Error

Started by iRiky, 15 February 2013 - 09:11 AM
iRiky #1
Posted 15 February 2013 - 10:11 AM
Here's is the code.It's for a automatic XP Farm
he said "bios:338 [string "startup"] :8: Syntax error

i don't understand this because at line 8 i've got an end..


x = peripheral.wrap("right")
while true do
turtle.attack()
x.collect()
turtle.drop()
if rs.getInput("bottom")==true
then (shell.run("xpt"))
end
end

P.S. Using Misc Peripherals !
Doyle3694 #2
Posted 15 February 2013 - 10:16 AM
Your if statement is messed up:

if rs.getInput("bottom") then
 shell.run("xpt")
end
theoriginalbit #3
Posted 15 February 2013 - 10:22 AM
Your if statement is messed up
While the if statement doesn't follow convention or how you and I would write it, it isn't actually incorrect. the problem is that the OP has surrounded shell.run("xpt") in brackets, if you remove those brackets it will work perfectly fine.
Doyle3694 #4
Posted 15 February 2013 - 10:50 AM
Are multiline if statements allowed? O_o
theoriginalbit #5
Posted 15 February 2013 - 10:59 AM
Are multiline if statements allowed? O_o
yes indeed. this is syntactically correct

if this and
   that and
   (not thisThing or
   isDevEnv) then
   print("We have met these conditions!")
end