bs Type Decimal

If you need variables for calculating numbers with decimal values, it's better to work with variables declared with "dec

This variable type allow you to use many math functions.

Note: Here you must work with placeholder too.

 

Assign values to variables and add them together:

// assign the value 5.3 to x and define x as decimal value

dec x=5.3   

// assign the value 2.2 to y
dec y=2.2

// assign the result to z (x + y) 
dec z

z=<x>+<y>

messagebox=<z>

 

Wrong:

dec z=<x>+<y>

 

Note: if the placeholder is not a decimal value, you must convert it to number

dec y,z
setvar=x=5.3
y=2.2
z=<y> + <x,num(6)>

 

 
The assignment operator (=) assigns a value to a variable.
 
Assignment
dec x

x=10

 

 
The addition operator (+) adds numbers:
 
Adding
dec x,y,z
x=2
y=3
z=<x> * <y>

 
The multiplication operator (*) multiplies numbers.
 
Multiplying
dec x,y,z
x=2
y=3
z=<x> * <y>

 

 

 

BeasScript Arithmetic Operators

Arithmetic operators are used to perform arithmetic on numbers:

 

Operator        Description

+        Addition

-        Subtraction

*        Multiplication

/        Division

 

Brackets and many math functions supported

dec x
x=5+3*6
messagebox=<x>
// return 23.00000

 
Arithmetic operators are fully described in datawindow expression

 

 

BeasScript String Operators

For Strings and all other formats operators are not available.

The system adds all placeholders

 

Example

string txt1,txt2,txt3
txt1=Martin
txt2=Doe
txt3=<txt1> <txt2>
messagebox=<txt3>
// Return: John Doe

 

 

Alternative variant is setvar. 

setvar=txt1=Martin
setvar=txt2=Doe
setvar=txt3=<txt1> <txt2>
messagebox=<txt3>