Comment on page
Sanny Builder supports many common operations to be written without an explicit opcode. The compiler, in this context, analyzes both the left and right sides of the expression as well as the operator between them to determine the appropriate opcode to use.
Due to the nature of the language, there are different opcodes for different types of data involved in operations. For instance, adding integer values requires a distinct opcode compared to adding two floating-point values. In most cases, the compiler is able to figure out the opcode automatically, but sometimes an upfront declaration of variable types is needed to disambiguate the opcode.
The majority of supported operations in Sanny Builder involve just two operands: one on the left-hand side (LHS) and another on the right-hand side (RHS).
LHS = RHS- an assignment operation.
RHSis a numeric constant, variable, or string literal. In this context,
LHSalways refers to a variable.
LHS += RHS- an addition operation.
RHSmust be of the same type, either integer or float. The value of
LHSgets incremented by the value of
LHS -= RHS- a subtraction operation
LHS *= RHS- a multiplication operation
LHS /= RHS- a division operation
The following operations require the
LHS = value1 + value2- add two integer values together and write the result in
LHS = value1 - value2- subtract one integer value from another and write the result in
LHS = value1 * value2- multiply two integer values and write the result in
LHS = value1 / value2- divide one integer value by another and write the result in
LHS == RHS- an "equal to" operation. Both sides must have the same value for the comparison to return true
LHS > RHS- a "greater than" operation
LHS >= RHS- a "greater than or equal to" operation
LHS < RHS- a "less than" operation
LHS <= RHS- a "less than or equal to" operation
LHS <> RHS- a "not equal" operation. Both sides must have different values for the comparison to return true
Casting operations convert a value from one type to another. The game supports a conversion between