Loops, Conditional Statements, Functions, Arrays Example


Display a for Loop:

This will display all the trucks in an array.

Display a for/in Loop:

This will display all of the fields in a record with format lname, fname, age.


Display a while Loop:

This will display a row with the current index value in a while loop 10 times. It will execute the loop after checking the condition.

Display a for/in Loop:

This will display a row with the current index value in a while loop 10 times. It will execute the loop before checking the condition.


If/Else Condition:

Display a greeting based on the time of day. If it is before 6PM, it will display 'Good day', else it will display 'Good evening'.

If/Elseif/Else Condition:

Display a greeting based on the time of day. If it is before 12N, it will display 'Good morning', elseif it is before 6PM it will display 'Good afternoon', else it will display 'Good night'.


Switch Condition:

Display the day of the week based on the current date.

Object Datatype:

This function creates a person object and displays the fields (first name, last name, age, and eye color).


Associative Array:

Attempts to reference an array using a name, rather than a numeric value. This causes unpredictable and incorrect results.