Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • string - defines a string, example literal is "abc"
  • boolean - defines boolean values true and false
  • number - any numeric (integer or real) valuevalue
  • integer - a numeric value without a fractional component
  • date - a date, like "2010-03-30"
  • interval - a time interval, like "2d 3h"

...

  • interval - data type does not represent the working interval (i.e. 8h), but the full interval. When we created SIL™ we thought about if we should introduce a working interval type (i.e. 8h / day) but this would have certain undesired implications (how long is your workday? in France, for instance, Friday is only 6h). With our custom fields, it's a matter of interpretation of the interval, and we have routines to help you transform a 24h interval to a working interval, or you can simply write your own.
  • date - data type can be used to represent dates and date-times.
  • number - data type internal storage is represented only by real numbers (double). However, the language accepts for historical reasons type declarations as "integer", "int", "real", "double", "float" (treating them as "number", of course). Until now we have found no limitations regarding the uniform treatment of numbers.

Arrays

Multi-value (arrays) types are also supported and composed of the base type followed by the array symbols [ ]  for each dimension of the array type. This translates to the following being valid array types:

  • string[]
  • boolean[]
  • number[][]
  • integer[]
  • date[][][]
  • interval[]
  • Person[][] - where Person is a user-defined structure

...

Code Block
titleExample
string name = "John Doe";
numberinteger random = 2;
number pi = 3.14;
boolean valid;
date today = currentDate();
interval spent = "1h 30m";
interval estimate = "2d" - spent;
number [][] matrix = {{0,1}, {2,3}, {4,5}};

...

Code Block
(<target_type>)varname


Code Block
titleExample
numberinteger n = 1;
number x = 3.14;
string s = "2";
return n + s; // what will this return? 3 or "12"?
return (string)n + s; // now we know that adding 2 strings will result in "12"
return n + (number)s; // adding 2 numbers will definitely return a number (3)

...