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

if statement not working expects (

Started by mibs3, 03 January 2013 - 11:10 AM
mibs3 #1
Posted 03 January 2013 - 12:10 PM
the code says it needs a ( on line 3 but i dont see anywhere it is necessary
the code is currently not complete so i have it set to only run 1 function 1 time

i had to put in _ before lines so it would show the spacing there they are spaces in the auctual code

–checks to see where blocks are and mines them if necessary
function digblocks
__if turtle.detect() then
____turtle.dig()
__end
__turtle.up()
__if turtle.detect() then
____turtle.dig()
__end
__turtle.turnRight()
__turtle.Forward
__turtle.turnLeft
__if turtle.detect() then
____turtle.dig()
__end
__turtle.down()
__if turtle.detect() then
____turtle.dig()
__end
__turtle.turnLeft()
__turtle.forward()
__turtle.turnRight()
end

– main code
digblocks()


the exact error i get is
bios:338: [string "mining2"]:5: '(' expected
remiX #2
Posted 03 January 2013 - 12:26 PM
Did you retype it here?

Because you forgot () in some of the functions near the middle of the code and function digblocks() needs it too.
theoriginalbit #3
Posted 03 January 2013 - 01:42 PM
A function declaration also needs () after its name. Also if you use the code tags it will preserve spaces when posting, looks better, and is easier to read. ['code] ['/code] without the ' in both of course.
mibs3 #4
Posted 03 January 2013 - 02:49 PM
thank you both for your help!
my code now both looks better and auctually works.