Vai al contenuto

Assignments

SemanticsThe assignment statement replaces the current value of a single or multi-element variable by the result of evaluating an expression.The assignment statement is also used to assign the value to be returned by a function, by placing the function name to the left of an assignment operator in the body of the function declaration. The value returned by the function is the result of the most recent evaluation of such an assignment.SyntaxAn assignment statement consists of a variable reference on the left-hand side, followed by the assignment operator “:=”, followed by the expression to be evaluated. For instance, the statementA := B ;would be used to replace the single data value of variable A by the current value of variable B if both were of type INT.Examplesa := b ;assignmentpCV := pCV + 1 ;assignmentc := SIN( x );assignment with function invocationFUNCTION SIMPLE_FUN : REALvariables declaration…function body…SIMPLE_FUN := a * b – c ;END_FUNCTIONassigning the output value to a function.