Skip to content
Paolo Angeli edited this page Oct 13, 2019 · 6 revisions

Arrays

Bool conversion

Arrays can be explicitly casted to booleans accordingly to the .count property. If .count == 0 the cast is false, unless is true.

arr : [..] float;                    // define a variable lenght array
...                                  // do something 
is_empty := ! cast(bool) arr;        // save a flag 

Must be explicit so eg. you can't pass an array to a procedure that expects a boolean as an argument.

The cast is implicit if the array name is placed in an if or in a while conditional statement.

arr : [..] float;                    // define a variable lenght array
...                                  // do something 
if arr {                             // If the array now contains some values 
  ...                                // Do something else
} 

This is because if statements have a so-called "lacks conversion of bools" that checks for availability of an implicit type-safe defined boolean conversion.

Types, constants and variables

  • Variables and assignments
  • Language data types
  • Simple user-defined data types
  • Expressions and operators
  • Type-casting
  • Pointers

Flow control

Procedures and functions

  • Declarations
  • Arguments / Parameters
  • Return values
  • Overloading / Polymorhism
  • Advanced features
  • Lambdas

Aggregated data types

  • Arrays
  • Strings
  • Composition of Structs

Advanced features

Clone this wiki locally