From WikiChip
/if Command - mIRC
< mirc‎ | commands

The conditional statements 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 operators

Synopsis[edit]

if (<condition>) <statement>
if (<condition>) { <statements> }

Switches[edit]

Parameters[edit]

  • <condition> - a conditional expression to be executed

Example[edit]

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[edit]

Added: mIRC v4.5
Added on: 30 Jun 1996
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also[edit]

[Expand]
v · d · e mIRC commands list