What Symbols are used in coding? Part 1
1.Semicolon ;
The semicolon tells the compiler you have reached the end of a command or statement. It ends the line of code similar to what a period does for a sentence.
Examples:
var i = 10
if (i > 15) document.write("10 is less than 15");;
2.Curly Braces { }
Curly Braces are used to group statements and declarations. Opening brace needs to be followed by a closing brace or the code will not run. Missing or unbalanced braces are often causes of errors in code.
Examples:
if (boolean expression) {
// any statement(s)
}
else if (boolean expression) {
// any statement(s)
}
else {
// any statement(s)
}
3.Bracket of Parentheses ()
Brackets of Parentheses control the order of operations of an expression and provide parameters or arguments to a function or method and can be used for comparison.
Examples:
print("Hello World!
||
while (condition)
)
4.Equals (assigning value) = and is different from == or ===.
Used to assign values to variables.
Example:
int x = 10;
5.Is Equal to ==
Used to compare two operands are equal or not, if yes then it’s true and if not then it’s false. == ignores the datatype. (=== it compares variables and datatypes of the two values to see if they are equal.)
Example:
"1" == 1; // tru
1 == "1"; // true
0 == false; // true
0 == null; // false
0 == undefined; // false
null == undefined; // true