var

Syntax

var variableName : typeName = value;

where:

Description

This statement enables to create a new variable and to initialize its value.

MQL is a loosely-typed language. Variables can be declared before using them, and typed if desired, but neither one of these is necessary. It is up to you to determine if declaring and typing is important.

Examples

Creates a String variable and initializes its value:

var myString : String = "Hello World";

Creates a List variable and initializes its value:

var seasons = ["winter", "spring", "summer", "autumn"];

Creates a UML 2.1 Class:

var class : uml21.Class = myModel.create("Class");