They return numeric values (Powers or Skills) after being evaluated.
Operators:
+
: Addition.
-
: Subtraction.
*
: Multiply.
/
: Skill division. Takes 2 Powers and returns a Skill.
//
: Integer division. Takes 2 Powers and returns a Power that corresponds to the division's quotient.
%
: Modulus. toma dos enteros y regresa un entero que corresponde al resto de la división.
-
: Minus. Takes a Power or Skill and multiply it by-1
.
#
: Length. Takes an array or list and returns the number of elements it contains.
They return boolean values (Win
or Lose
) after being evaluated.
Operators between booleans:
||
: Disjunction.
&&
: Conjunction.
!
: Negation.
Operators between any scalar type:
==
: Equality. For pointers it compares the pointed elements.
!=
: Inequality. For pointers it compares the pointed elements.
>
: Greater than. For characters the normal lexical order is followed.
>=
: Greater or equal than. For characters the normal lexical order is followed
<
: Less than. For characters the normal lexical order is followed
<=
: Less or equal than. For characters the normal lexical order is followed
Ternary conditional operator:
Boolean expression
quest
Win
case functionloot
Lose
case functionEvaluates and returns the result of the
Win
case function orLose
case function, depending if the boolean expression evaluatesWin
orLose
.
They return a character after being evaluated.
Monadic prefix operators:
buff
: Uppercase. Converts the given alphabetic character to its uppercase representation.
debuff
: Lowercase. Converts the given alphabetic character to its lowercase representation.
They return an array or list after being evaluated.
Operators:
|)(|
: Array indexing. Index range[0..#array - 1]
.
|><|
: List indexing. Index range[0..#list - 1]
.
::
: List concatenation. Takes 2 lists and appends the second to the first.
:
: List insertion (annex) Prepend a head element to a list.
Access operator:
spawn
It takes a record or union and an id, and if it matches a field, returns the value in it.
To know more go to Records and Unions data types section.
Dereference operator:
puff
Given a variable of the pointer type, it returns the value that was pointed by the given variable.
In the case that the variable is not dereferenced, its address is the one being used.
To know more go to Pointers data type section.
Precedence in descending order:
Operator | Firts level | Second level | Third level | Fourth level |
---|---|---|---|---|
Aritmetic | Minus, Length | Integer Division, Modulus | Multiply, Division | Addition, Subtraction |
Boolean | Negation | Conjunction, Disjunction | Ternary | Comparators |
Character | Uppercase | Lowecase | ||
Arrays | Indexing | |||
Lists | Indexing, Annex | Concatenation | ||
Record | Access | |||
Pointer | Dereference |
Operator | Izquierda | Derecha | No asocia |
---|---|---|---|
Aritmetic | Multiply, Division, Integer Division, Modulus | Addition, Subtraction, Minus, Length | |
Boolean | Conjunción, Disyunción, Ternary | Negation | Comparators |
Character | Uppercase, Lowercase | ||
Arrays | Indexing | ||
Lists | Indexing, Annex, Concatenation | ||
Record | Access | ||
Pointer | Dereference |
Expressions are evaluated from left to right.
- Playit Programming language
- Program's Structure
- Source code file extension
- Variables identifiers (id's)
- Data types. Scalars
- Data types. Composite
- Block and Scope
- Comments and White spaces
- Instructions
- Assignment
- Conditional
- Loops
- Input/Output
- Map (Under development)
- Flow control structures
- Selection
- Loops
- Determined
- Indetermined
- Loop break
- Skip current iteration
- Alter current execution (Under development)
- Subroutines
- Examples
- Compile and run
- Extras