En:Declaration of variables and arrays

Материал из Pocket Fallout для КПК на PDA PC PPC Mobile.

In PFSL language there is no strong data typing. Type of variable (array element) is declared on first value assignment. More detailed see Data types.

Содержание

Variables


In PFSL language variables are declared by means of a keyword var.

Variables declaration syntax

var <variable_name>[=<value>];
or
var <variable_name1>[, <variable_name2>, …,<variable_nameN>];


Variables declaration example

var myFirstVar = 123456;
var myName = "Nikita";
var i, j, t;

Arrays

In PFSL language arrays are declared by means of a keyword dim. Array size is declared in square brackets :

Arrays declaration syntax

dim <array_name>[<size>];

Square brackets are used for access to the specified array index :

<array_name>[<index>];

Additional note
First array element has index 0.

Arrays declaration example

dim myArray[2];
myArray[0]="Hello"
myArray[1]="World !";
var message = myArray[0] + ", "+myArray[1];

See also

Multidimensional arrays

Личные инструменты