SIC includes structured logical tests of the form
IF Logical_Expression [THEN] ... ELSE IF Logical_Expression [THEN] ... ELSE ... ENDIFThe syntax is similar to FORTRAN with two major differences. First, the logical expression of an IF command cannot be followed by another command to be executed, and the THEN keyword is optional. Second, ELSE and IF must be separated by at least one space or tab in the ELSE IF command. Nesting of IF blocks up to 20 levels is allowed. In addition, provided the restriction on the number of loops, procedures and IF blocks is met, any nesting between loops, procedures and IF blocks is allowed.
Variables can appear in the logical expressions, and this is one of the most frequent use for variables. An IF block must be complete in a procedure or loop, otherwise an error occurs.
Logical expressions may include operations on arithmetic, logical or character variables. In logical expressions, strings (i.e. text included between double quotes) are recognized as character constants. Character variables should not be included between single quotes, since their current values would be substituted by SIC before logical expression analysis. Arithmetic sub-expressions are allowed.
Assuming GOOD is a character variable whose current value is "Let it be", and PI = 3.1415926535897932 (Double precision), examples of valid logical expressions are :
L = ("I am happy".EQ.GOOD) (.FALSE.) L = ("Let it be".EQ.GOOD) (.TRUE.) L = ("I am happy".EQ."'GOOD'") (.TRUE.) evaluated literally since GOOD is not substituted in a string L = PI.EQ.ACOS(-1.0) (.TRUE.) L = 'PI'.EQ.2*ASIN(1.0) (.FALSE.) evaluated as 3.141592653589793.EQ.2*ASIN(1.0) because of implicit formatting, one digit being lost in the formatting because of binary to decimal conversion. L = ("I am happy".NE.GOOD).OR.(PI.EQ.ACOS(-1.0))But the following expressions are invalid :
L = (PI.EQ.GOOD) Variable type mismatch. L = ("I am happy".NE.'GOOD') Because it is evaluated as ("I am happy".NE.Let it be).