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

Help With Code (End Expected)

Started by Appleeater, 23 March 2013 - 06:19 AM
Appleeater #1
Posted 23 March 2013 - 07:19 AM
Hello everyone.
I am trying to make a login script but i get the error:


bios:338: [string "startup"]:13: 'end' expected (to close 'if' at line 10

My Code

or

pastebin get y2nDyV8F
Kingdaro #2
Posted 23 March 2013 - 07:21 AM
Remove the parentheses after "break".
Appleeater #3
Posted 23 March 2013 - 07:23 AM
Remove the parentheses after "break".

parentheses? what are they?
Engineer #4
Posted 23 March 2013 - 07:25 AM
Remove the parentheses after "break".

parentheses? what are they?
parantheses are (), so you should use break instead of break()
Appleeater #5
Posted 23 March 2013 - 07:26 AM
Thanks, i understand parentheises now
Appleeater #6
Posted 23 March 2013 - 07:28 AM
Um there is still a problem. When i go to input a password it breaks to the normal console
Engineer #7
Posted 23 March 2013 - 07:36 AM
Um there is still a problem. When i go to input a password it breaks to the normal console
try changing password_enabled to:

password_enabled = true

But this is actually not needed, for your while loop you can use:

while true do
   -- code
   if some condition then break end -- optional
   --and have a little bit of delay, so you avoid errors, in your case I recommend:
   sleep(1) --OUTSIDE the if statement.
end

Break does what it says, it breaks out of the loop. If there is more code under that, it will run that and if not, in your case, it will just return because it has nothing to be executed.