Level 1 — The basics
Basic operations
Original notes by SunDiaL · View English source
Basic operations are provided out of the box and are the building blocks of everything else. They are:
Arithmetic operations
Arithmetic operations take two numbers as input and have another number as output. They are:
+-> Addition--> Subtraction*-> Multiplication/-> Division%-> Modulo (returns the remainder of the division)
Note, as they use symbols, these are operators.
Examples
1 + 1; // = 2
5 - 3; // = 2
2 * 3; // = 6
6 / 2; // = 3
7 / 2; // = 3 because of truncation
7 % 2; // = 1
7.0 / 2; // = 3.5
Logical operations
Logical operations take two booleans as input and have another boolean as output. They are:
&&-> AND||-> OR!-> NOT^-> XOR (exclusive OR) Note, as they use symbols, these are operators. The math involving booleans is called boolean algebra.
Examples
true && true; //true
true && false; //false
false && false; //false
Comparison operations
Comparison operations take any two objects (usually numbers) as input and have a boolean as output. They are:
==-> Equals!=or<>-> Not Equals<and<=-> Less than, Less than or equal>and>=-> Greater than, Greater than or equal Note, as they use symbols, these are operators.
String operations
String operations are basic operations only because they are provided out of the box by every programming language. They are actually functions. Examples include: concatenation, comparison, replacing part of a string with another, trimming, searching, splitting, joining, etc.
Collection operations
Collection operations are basic operations only because they are provided out of the box by every programming language. They are actually functions Examples include: Adding, removing, iterating, sorting, filtering, mapping, etc.