Calculating expression

 

Example1: No variable

Write SPL script:


A

1

=eval("(1+1)*2")

A1 The eval function dynamically phrases and calculates the expression, and the calculated result is 4

 

Example 2: Variables

Write SPL script:


A

1

=eval("a=1")

2

=eval("if(a>2,1.5,0.5)")

A1 The eval function dynamically phrases and calculates the expression, and the variable a is assigned 1 

A2 The eval function dynamically phrases and calculates the expression. The calculation result is 0.5