# Expressions with commands

Expressions can also be used to construct parameters for commands, as shown in this example.

    valueA as integer = 0
    valueB as integer = 0

    valueA = 2 * 20
    valueB = 3 + 5 * 8

    do
    	print ( valueA )
    	print ( valueB )
    	print ( valueA + valueB )

    	sync ( )
    loop

The variables valueA and valueB get declared and given initial values of 0. Following on from this valueA has been assigned the result of the expression 2 * 20, which is 40. The variable valueB is assigned the result of the expression 3 + 5 * 8. Remember that the operator order takes precedence here, with the multiplication operator taking higher precedence than the addition operator, therefore the multiplication part of the expression takes place first, leaving the expression 3 + 40, therefore the variable valueB gets assigned the value of 43.

The code within the do loop of the program makes three calls to the print command. The first call displays the contents of valueA. The second call shows the value of valueB. The third and final call to the print command demonstrates how you can use an expression to construct the parameter that this command requires. The expression adds the values of valueA and valueB together, which ends up being 83.