In this article
Semi-Colon ; - the semi-colon is used to indicate the end of an expression or a declaration.
Example:
var sentence : String;- Curly Brackets {} - curly brackets are used to create a section of code. As such they are required to delimit the bodies of namespaces, classes, structures, exceptions, etc.
- Parentheses() - uses parentheses to isolate a group of items that must be considered as belonging to one entity. Parentheses can also be used to isolate an operation or an expression with regard to another operation or expression.
- Comma , - the comma is used to separate variables used in a group.
- Assignment = - when you declare a variable, a memory space is reserved for it. That memory space may be empty until you fill it with a value. To "put" a value in the memory space allocated to a variable, you can use the assignment operator represented as =.
Example:
var age : int = 27;Single-Quote ’ - the single quote is used to include one character to initialize, or assign a symbol to, a variable declared as char.
Example:
var Gender : char = ’M’;Double-Quotes “ - the double-quote " is used to delimit a string.
Example:
print(”Welcome”);Square Brackets [ ] - Square brackets are mostly used to control the dimension or index of an array.
Example:
var number : int[] = new int[2];number[0] = 12;number[1] = 24;Comparison Operators
Comparison Operators are as follows:
- == - equal to;
- != - not equal to;
- < - less than;
- <= - less than or equal to;
- >= - greater than or equal to.
Logical Operators
Logical Operators are as follows:
- && - logical AND
- || - logical OR
- ! - logical NOT
In an AND comparison, both statements must be TRUE in order for the condition to return TRUE:
- True && False == FALSE
- True && True == TRUE
In an OR comparison, only one of the statements needs to be TRUE for the condition to be TRUE:
- True || False == TRUE.