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

If then bug?

Started by GyroW, 13 July 2013 - 04:06 AM
GyroW #1
Posted 13 July 2013 - 06:06 AM
I'm trying to write a really simple program using the advanced computers and the miscperipherals chatbox.
Not working, really weird i'm using the if statement in it to check what the players says and if it says the right thing it will activate a door.
And i always get the error "bios:338 [string:jarvis]:3: 'then' expected.
Even if i make the most simple if program ever
if 1=1 then
print("ok")
end
I get the same darn error.
Is this a bug with the advanced computers
(Ps i'm using the ftb ultimate pack so CC and Miscperihperals from 1.4.7)
Any help would be handy.
svdragster #2
Posted 13 July 2013 - 06:29 AM

local TestBoolean = true
if TestBoolean then -- Is the same as if TestBoolean == true
  print("Yay")
else
  print("Naw")
end
Jan #3
Posted 13 July 2013 - 06:33 AM
In lua, when you compare two things, you should use == instead of =


if 1==1 then
print("ok")
end

setting variables is done with a single =
svdragster #4
Posted 13 July 2013 - 06:38 AM
Isn't that in every language the same?
GyroW #5
Posted 13 July 2013 - 06:44 AM
Thanks jan, i forgot about that :(/>
Sorry to bother you guys
theoriginalbit #6
Posted 13 July 2013 - 07:00 AM
Isn't that in every language the same?
Nope.

One example……. Pascal:

if someInt = 1 then
  result := true
else
  result := false