From WikiChip
Difference between revisions of "mirc/commands/if"
m (Bot: Adding a template) |
m (Bot: Fixing links) |
||
Line 1: | Line 1: | ||
− | The [[conditional statements - mIRC|if statement]] is a built-in construct capable of comparing a value and executing a set of commands based on the result of that condition. The if statement is used in conjunction with the | + | The [[conditional statements - mIRC|if statement]] is a built-in construct capable of comparing a value and executing a set of commands based on the result of that condition. The if statement is used in conjunction with the {{mIRC|/else}} statement and the {{mIRC|/elseif}} statement to jump to certain blocks of code depending on the result of the conditional statement that was executed. The if statements supports the [[operators - mIRC|following operators]]. |
== Synopsis == | == Synopsis == | ||
Line 43: | Line 43: | ||
* [[$isalias identifier - mIRC|$isalias]] | * [[$isalias identifier - mIRC|$isalias]] | ||
* [[$iif identifier - mIRC|$iif]] | * [[$iif identifier - mIRC|$iif]] | ||
− | * | + | * {{mIRC|/alias}} |
− | * | + | * {{mIRC|/goto}} |
− | * | + | * {{mIRC|/halt}} |
− | * | + | * {{mIRC|/return}} |
− | * | + | * {{mIRC|/while}} |
− | * | + | * {{mIRC|/returnex}} |
− | * | + | * {{mIRC|/elseif}} |
− | * | + | * {{mIRC|/else}} |
{{mIRC command list}} | {{mIRC command list}} | ||
[[Category:MIRC commands]] | [[Category:MIRC commands]] |
Revision as of 18:42, 5 July 2014
The if statement is a built-in construct capable of comparing a value and executing a set of commands based on the result of that condition. The if statement is used in conjunction with the /else statement and the /elseif statement to jump to certain blocks of code depending on the result of the conditional statement that was executed. The if statements supports the following operators.
Synopsis
if (<condition>) <statement> if (<condition>) { <statements> }
Switches
Parameters
- <condition> - a conditional expression to be executed
Example
Below is a simple example of checking for at least five arguments before proceeding.
alias example { if ($0 < 5) { echo -atc info * /example: You must provide at least 5 arguments! | halt } ; do something useful here echo -a works! }
Executing "/example a b c d" will result in:
* /example: You must provide at least 5 arguments!
While, executing "/example a b c d f" will result in:
works!
Compatibility
Added: mIRC v4.5
Added On: 06/30/96
Note: Individual switches were not taken into consideration.
See also
- List of commands
- List of identifiers
- $halted
- $result
- $alias
- $isalias
- $iif
- /alias
- /goto
- /halt
- /return
- /while
- /returnex
- /elseif
- /else
mIRC commands list