Conditional structures: Difference between revisions

Content added Content deleted
(Add Batch File section)
Line 1,044: Line 1,044:
break;
break;
}</lang>
}</lang>

=={{header|Batch File}}==
IF syntax:
<lang dos>
IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command
IF CMDEXTVERSION number command
IF DEFINED variable command
IF [/I] string1 compare-op string2 command
where compare-op is:
EQU - equal
NEQ - not equal
LSS - less than
LEQ - less than or equal
GTR - greater than
GEQ - greater than or equal
/I case insensitive string compares
</lang>
The ELSE clause must be on the same line as the command after the IF.
For example:
<lang dos>
IF EXIST %filename% (
del %filename%
) ELSE (
echo %filename% not found
)
</lang>




=={{header|D}}==
=={{header|D}}==