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

Bios:337: [String "startup"]:35:

Started by candycool1234, 10 August 2013 - 01:58 PM
candycool1234 #1
Posted 10 August 2013 - 03:58 PM
'End' expected (to close 'if' at line 15) I am working on adding a logo in but I just need to fix this small error I cannot seem to fix link to code here http://pastebin.com/2puDqQX5
Bubba #2
Posted 10 August 2013 - 04:13 PM
You should read the error instead of just immediately coming on the forums to ask the question. See how it says "End expected to close if at line 15"? That means that you are missing an "end" to the if statement that starts at line 15.
candycool1234 #3
Posted 10 August 2013 - 04:38 PM
Oh so I was not aware that u needed to add a end to if statements when u wish to have the if to continue to the next if statement.
candycool1234 #4
Posted 11 August 2013 - 07:07 AM
Bubba your fix to add a end to the if statement did not work it causes me a startup:2: nill error so I need some actual help
candycool1234 #5
Posted 11 August 2013 - 07:12 AM
Oh and bubba just because someone came to fourms does not mean they did not spend 20 min trying to fix it on there own of witch I did I use fourms as last result reason I have so many pots is because I code oh so often

Posts iPhone auto correct suckes.

Which sorry auto correct
reububble #6
Posted 11 August 2013 - 08:14 AM
Candycool1234 you need to add the end to the very end of the script.

To avoid problems like these you should use indents in your code.
You see, this code uses a maximum of 2 indents rather than a simple 1 (or none).

In general your program would be more understandable if you indented like this

-- User Check
if user == correctuser then
  -- Password Check
  if pass == correctpass then
	-- Unlock door
  else
	-- Lock door
  end
end

Also I get the feeling that you would like an else event for the incorrect user, which would be best achieved by adding a separate else event in the zero indented end section to the user check.
immibis #7
Posted 11 August 2013 - 08:31 AM
Bubba your fix to add a end to the if statement did not work it causes me a startup:2: nill error so I need some actual help
That's a different problem. That's because you didn't set mon anywhere.
Bubba #8
Posted 11 August 2013 - 09:22 AM
Oh and bubba just because someone came to fourms does not mean they did not spend 20 min trying to fix it on there own of witch I did I use fourms as last result reason I have so many pots is because I code oh so often

Posts iPhone auto correct suckes.

Which sorry auto correct

Yeah, sorry I can be an asshole at times. Anyway, next time you have an error check if it exists on this list. That has a good majority of the common errors we see, and it should help you out. However, my advice does still stand that you are missing the end. The new error is related to what immibis said, in that you did not set the variable mon anywhere.
candycool1234 #9
Posted 11 August 2013 - 04:33 PM
So do not add mon I just want it on my screen I broke off drone codeine for a bit and I was not aware of where you wanted me to add the end so thank you guys
candycool1234 #10
Posted 11 August 2013 - 04:42 PM
Sorry my code was just for me so I did not clean up with tab
candycool1234 #11
Posted 11 August 2013 - 04:49 PM
So how do I set the mon to the computer
candycool1234 #12
Posted 11 August 2013 - 04:55 PM
Nvm i know I need to use term not mon I'm sorry
jay5476 #13
Posted 11 August 2013 - 05:30 PM
If you go on the wiki there should be semi useful info on some of the functions in term