7.5

Table Of Contents
gsave and grestore are required to be issued in pairs, meaning that you need the equal number of gsave and grestore
commands to run in any given object. However, an uneven number of commands can be located in the code, if some of them
are within IFstatements, so that when the code is actually run, the pairing occurs correctly in all instances.
Example
moveto( 1, 1 )
%Position is now 1,1
gsave()
%Save current state
lineto( 2, 1 )
%Position is now 2,1
lineto( 2, 2 )
%Position is now 2,2
grestore()
%Restore previous state: position is now 1,1
If ElseIf… EndIf (procedure)
This command structure can define up to two conditional blocks. Statements nested within the first block are executed only if
the condition specified in the if statement returns true. If it returns false, the program branches to the first statement in the sec-
ond block, if one has been defined using the elseif statement. Otherwise, control flows to the first statement following the endif
command.
With PlanetPress Suite version 7.0, the elseif statement has been optimized to evaluate an argument, exactly like an if state-
ment, and elseif statements from other programming languages. In order to complete the if...elseif...endif command struc-
ture, however, an else statement was also added, acting exactly like the previous, empty elseif. Note that the use of the else
statement is strongly recommended, as it is optimized by comparison to the elseif statement. Also note that documents
created with previous versions and using the if...elseif...endif structure will not be updated, for full backward compatibility.
Syntaxes
Prior to version 7.0
if( condition )
elseif()
endif()
Version 7.0 and above
©2010 Objectif Lune Inc - 426 -