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

[Error] bios:338: [string "CMD"]:4: '=' expected

Started by SNWLeader, 16 January 2013 - 02:59 PM
SNWLeader #1
Posted 16 January 2013 - 03:59 PM
I have no idea what I am doing wrong, but whenever I use loop in something the program keeps telling me that error in the title.
here is the code I have.

overide = "overide"
passcode = "passcode"
loop
term.clear()
term.setCursorPos(1,1)
print("Tangent Lock 3.0")
write("input:  ")
input = read("*")
if input ~= passcode then
print("Incorrect Passcode")
sleep(1)
end
until input == passcode or input == overide
print("Passcode Accepted!")
sleep(1)
term.clear()
term.setCursorPos(1,1)
theoriginalbit #2
Posted 16 January 2013 - 04:08 PM
Could have just left the topic where it was… a moderator would have moved it…

now the problem it has is that the word "loop" doesn't exist… so it was expecting you to assign something to it… loops are as follows

While loop:

while <conditional is true> do
  -- code in here
end

Repeat loop

repeat
  -- code in here
until <conditional is true>

For loop

for num = 1, <number of times to loop> do
  -- code in here
end
SNWLeader #3
Posted 16 January 2013 - 04:13 PM
Ah thats why.
my fault teehee.