GPDL Assignment Statements
An assignment statement assigns a value to a variable using the equal sign. Example:
$FUNC abc ( x ) { $IF ( $NOT ( $EQUAL ( x , "Dagger" ))) { x = "Knife" ; // Example of assignment } ; $RETURN x ; } abc ;
In this example, the variable to which a value is assigned is the formal parameter of the function. The variable, 'x', is set to "Knife" unless it started out as "Dagger". Its value is then returned as a result of calling the function 'abc'.
Again, all data in GPDL consists of strings. The compiler accepts integers as literal data but converts them to strings without warning. Examples:
x = 3 ; equivalent to x = "3" ; x = 03 ; equivalent to x = "3" ; x = 0xA ; equivalent to x = "10" ; // Hexadecimal
Notice that the assignment statement does not result in a value. Unlike 'C', you cannot use an assignment statement in an expression:
x = (a = b); // Compile error $IF ( x = y ) // Compile error