Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Expressions > Casting operators

Casting operators

Casts are used to convert the value of an expression to the desired type. It is marked with parentheses containing the name of the type before the expression. Possible casts are:

boolean, converts to anvil.lang.boolean. Same as the call to toBoolean method.

int, converts to anvil.lang.int. Useful only with integers, floats, and strings.

float, converts to anvil.lang.float. Useful only with integers, floats, and strings.

string, converts to anvil.lang.string. Same as the call to ``toString´´ method.

  cast-expr := "(" "boolean" ")" expr 
  cast-expr := "(" "int" ")" expr 
  cast-expr := "(" "float" ")" expr 
  cast-expr := "(" "string" ")" expr 
See also  | Expressions  | Grammar
Contributes notes:
Add a note
What's new | Anvil