Next: , Previous: , Up: Commands   [Contents][Index]


3.10 if

New syntax:

      if (<condition>) { <command>; <command>
             <commands>
             <commands>
      } else {
             <commands>
      }

Old syntax:

      if (<condition>) <command-line> [; else if (<condition>) ...; else ...]

This version of gnuplot supports block-structured if/else statements. If the keyword ‘if‘ or ‘else‘ is immediately followed by an opening "{", then conditional execution applies to all statements, possibly on multiple input lines, until a matching "}" terminates the block. If commands may be nested.

The old single-line if/else syntax is still supported, but can not be mixed with the new block-structured syntax. See if-old.