Credits Overview Plotting Styles Commands Terminals

if

Syntax:

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

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 pre-version 5 single-line if/else syntax is still supported, but can not be mixed with the new block-structured syntax. See if-old.

Subtopics