You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function: bubbleSort(&$array)
for ($i = 1, $i < $array->getSize()#-+ 1-#, ++$i)
for ($j = 0, $j < $array->getSize() - $i, ++$j)
#-
if ($array[$j] > $array[$j + 1])
swap($array[$j], $array[$j + 1])
end
-#
end
end
end
1.2. Enums
enum Colors
$RED[ = 0]
$GREEN[ = 1]
$BLUE[ = 2]
end
...
$color = Colors.$RED
switch($color)
case(Colors.$RED)
console.printLine("RED")
end
case(Colors.$GREEN)
console.printLine("GREEN")
end
case(Colors.$BLUE)
console.printLine("BLUE")
end
default
console.printLine("No specific color selected")
end
end
1.3. Structures, which are compound data types, including sub data type definitions, used for data validation
structure CarData
$tireCount: Integer
$color: Integer
end
1.4. Data objects, which can optionally be validated
data Car [validated-by CarData]
private $tireCount = 4
private $color = "red"
end
Class::$classProperty would map to $$.___Class_classProperty
class Class
static public $classProperty = 4
static method: classMethod()
console.printLine("Class::$classProperty = " + self::$classProperty)
end
end
...
console.printLine("Class::$classProperty = " + Class::$classProperty)