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

Help with password program

Started by Alex63zz, 22 December 2013 - 12:06 PM
Alex63zz #1
Posted 22 December 2013 - 01:06 PM
im trying to make a password on/of Switch
code:

print "Please Input Password:"
password =read ("*")
if password == "MYPASSWORD" then
rs.setOutput ("back", True)
print "Switch Off!"


And then i run the program, and it says: bios:338: [string "On"]:6: 'end' expected (to close 'if' at line 3)

im a noob so i cant find the error… :(/>
Lyqyd #2
Posted 22 December 2013 - 03:24 PM
Split into new topic.
rewbycraft #3
Posted 22 December 2013 - 03:31 PM

print "Please Input Password:"
password =read ("*")
if password == "MYPASSWORD" then
rs.setOutput ("back", True)
end
print "Switch Off!"
You forgot to end your if statement.
OReezy #4
Posted 22 December 2013 - 03:32 PM
Statements (example: if, while, for) must be closed with an 'end' to show where the statement stops.

Here's a basic if statement:
if x == "string" then
  --some code
else
  --some more code
end
Edited on 22 December 2013 - 02:32 PM