mardi 31 mars 2020

Lua, Else not allowed condition? - Why?

Why is the “else” statement not allowed to have a then? or conditions? (is it because it is the final condition within the else-if conditions it represents?)

I am struggling to understand this concept please give a simple explanation for a beginner programmer who just learned about variables.

The question I pose above, was discovered when I received a error with my “else” statement in the code I typed below:

`message = 0 condition = 30

if condition <=10 message = “try harder”

elseif condition <=20 then message = "Almost learning"

else condition = <=30 —This is the line where I get the error message message = "Now you’re getting it"

end print(message)`

Would appreciate someone breaking down in laymen terms why else is not allowed to have < or > or then or other conditions. Thank you.

Aucun commentaire:

Enregistrer un commentaire