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.
1 | if (string.len( "Jon" ) * 2 / ( 2 + 1 ) = = 2 ) then |
2 | print ( "The answer makes sense" ) |
3 | elseif (string.len( "jon" ) * 2 / ( 2 + 1 ) > = 2 ) then |
4 | print ( "the answer is nagative" ) |
5 | 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.