They automatically print the result in the console if written like this.
You can also perform math operations with variables.
It is possible to store the result of an operation in a variable, but it won't be printed in the console.
Operation between integers and floats
As they have different type, they can still be used together for math operations. It will automatically converts the result to a float. This is a LuaU feature.
Concatenate two strings
You can concatenate (assemble) two strings together with the SUM function.
It works with variables as well. You can store the result in a variable too.
Warning : you can't perform SUB, MPY and DIV on strings.
Division by zero and other impossible mathematical actions will result in an error.
Conditions and boolean operations
Simple condition with IF
A condition always start with IF followed by a condition. If the condition is true, the content of the condition block will be executed.
A condition always ends with END . If the condition is not true, nothing will happen.
Condition with ELSE and ELSEIF
If the condition is not true, you can set an ELSE statement.
In this case, the v3 value will be set to "v1 is less than v2"
If you desire to add another condition, use the ELSEIF statement
Comparison operators
You can use the following operators in conditions with Neurox :
< less than
> greater than
== equality
!= inequality
<= less or equal
>= greater or equal
These operators always result in false or true.
= and == are totally different. One equal symbol is used to set values to variables and double equal is used as an operator.
Logical Operators
In Neurox, logical operators are and, or and not. They work exactly like LuaU operators :
The negation operator not always returns false or true. The conjunction operator and returns its first argument if this value is false or nil; otherwise, and returns its second argument. The disjunction operator or returns its first argument if this value is different from nil and false; otherwise, or returns its second argument. Both and and or use short-circuit evaluation; that is, the second operand is evaluated only if necessary. Here are some examples:
DEFINE NEUROX
SET a = "hello"
SET b = "world"
SUM(a,b)
>>> "hello world"
DEFINE NEUROX
SET v1 = 1
SET v2 = 5
SET v3 = "None"
IF v2 > v1 THEN
SET v3 = "v2 is greater than v1"
END
DEFINE NEUROX
SET v1 = 0
SET v2 = 10
SET v3 = "None"
IF v1 < v2 THEN
SET v3 = "v1 is greater than v2"
ELSE
SET v3 = "v1 is less than v2"
END
DEFINE NEUROX
SET v1 = 10
SET v2 = 10
SET v3 = "None"
IF v1 < v2 THEN
SET v3 = "v1 is greater than v2"
ELSEIF v1 == v3 THEN
SET v3 = "v1 and v2 are equal"
ELSE
SET v3 = "v1 is less than v2"
END
10 or 20 --> 10
10 or error() --> 10
nil or "a" --> "a"
nil and 10 --> nil
false and error() --> false
false and nil --> false
false or nil --> nil
10 and 20 --> 20