Difference between revisions of "IF"

From VSI OpenVMS Wiki
Jump to: navigation, search
(Created page with "IF is a DCL command that tests the value of an expression and, depending on the syntaxspecified, executes the following: o One command following the THEN key...")
 
m
 
Line 1: Line 1:
IF is a [[DCL]] [[Command|command]] that tests the value of an expression and, depending on the syntaxspecified, executes the following: o One command following the THEN keyword if the expression is true o Multiple commands following the $THEN command if the expression is true o One or more commands following the $ELSE command if the expression is false  
+
IF is a [[DCL]] [[Command|command]] that tests the value of an expression and, depending on the syntaxspecified, executes the following:
 +
* One command following the THEN keyword if the expression is true
 +
* Multiple commands following the $THEN command if the expression is true
 +
* One or more commands following the $ELSE command if the expression is false  
 
=Syntax=
 
=Syntax=
 
  $ IF  expression THEN [$] command
 
  $ IF  expression THEN [$] command

Latest revision as of 19:50, 24 June 2022

IF is a DCL command that tests the value of an expression and, depending on the syntaxspecified, executes the following:

  • One command following the THEN keyword if the expression is true
  • Multiple commands following the $THEN command if the expression is true
  • One or more commands following the $ELSE command if the expression is false

Syntax

$ IF  expression THEN [$] command

or

$ IF  expression 
$ THEN 
$ command
$ [command]
$ ENDIF

or

$ IF  expression 
$ THEN 
$ command
$ [command]
$ ELSE
$ command
$ [command]
$ ENDIF