Next: , Previous: clear, Up: Commands


3.4 Do

Syntax:

           do for <iteration-spec> {
                <commands>
                <commands>
           }

Execute a sequence of commands multiple times. The commands must be enclosed in curly brackets, and the opening "{" must be on the same line as the `do` keyword. This command cannot be used with old-style (un-bracketed) if/else statements. See `if`. For examples of iteration specifiers, see iteration. Example:

           set multiplot layout 2,2
           do for [name in "A B C D"] {
               filename = name . ".dat"
               set title sprintf("Condition %s",name)
               plot filename title name
           }
           unset multiplot