Anveo Mobile App / Anveo Script Documentation / Variables, Conditions, Functions and Loops

Variables, Conditions, Functions and Loops

Declaration of a local variable

local variable;

Example: 
local myVariable;

Declare a local variable. This variable is only valid until the next end;

Definition a local variable.

local variable= value;

example: 
local Customer = Record('Customer');
local isValue = false;

Definition of a global text variable

variable1 = variable1 .. variable2;

example:
myText = 'new' .. ' Text';

If statement

if a == 2 then
 ...
elseif a == 3 then
 ...
else
 ...
end;

No BEGIN

no end; before elseif,

no end; before else,

end; is always required.

CASE-Statements do not exist, use elseif instead.

Functions with parameters

function functionName(Parameter1,Param2,...)
  return variableName;
end;

Declare a function with parameters. Return value is optional.

For loop

for i = startValue, endValue, step do
  ...
end;

example:
for i = 1, 10, 0.5 do
  ...
end;

While loop

while condition do
  ...
end;

example:
while i <= 5 do
  i = i + 1
end;

Repeat loop

repeat
  ...
until condition;

example: 
repeat
  i = i + 1;
until i <= 5;