if("Jon".length * 2 / (2+1) == 2 ) { console.log("The answer makes sense") } else if("jon".length * 2 / (2+1) >=2) { console.log("the answer is nagative") }
and is this there another way the script can be chaged
What you're writing is JavaScript. Here's how you could do the above in Lua.
if(string.len("Jon") * 2 / (2+1) == 2) then print("The answer makes sense") elseif(string.len("jon") * 2 / (2+1) >= 2) then print("the answer is nagative") end
Syntax-wise, rather than {
and }
brackets, which are used in many OOP languages like JavaScript, Lua uses a replacement for these in most cases...
{
can be a few keywords, like then
, do
, and others.
}
is usually end
, though it isn't used after each part of an if
statement.
Good luck! I hope this helps.