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

help with this code please

Started by qifocusman, 26 June 2013 - 12:47 AM
qifocusman #1
Posted 26 June 2013 - 02:47 AM
i made this code for a quick password program:


print("qifocusoft inc. password protection loaded")
print("enter password to continue")

input = read()

if input == "hi" then
print("ACCESS GRANTED")

end

else
print("nope.")
os.shutdown()

end

and i got this error:
bios:206: [string "startup"] :11: '<eof>' expected


PLEASE HELP ME!!
Edited by
Lyqyd #2
Posted 26 June 2013 - 03:14 AM
Split into new topic.

It's if / else / end, not if / end / else / end.
Apfeldstrudel #3
Posted 26 June 2013 - 04:08 AM
Title: help with this code please.

i made this code for a quick password program:

print("qifocusoft inc. password protection loaded")
print("enter password to continue")

input = read()

if input == "hi" then
print("ACCESS GRANTED")

end

else
print("nope.")
os.shutdown()

end


and i got this error:
bios:206: [string "startup"] :11: '<eof>' expected


PLEASE HELP ME!!

Its the if statenent, i was confused to :P/>/>/>

If that then
   Do stuff
end
else
  Do other stuff
end

^This wont work, the correct syntax is:

If that then
   Do stuff
else
  Do other stuff
end

Remove the end between if and else

Also, for passwords put a "*" in the parantheses of the ead function, it awesome