m |
m |
||
(10 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{mirc title|$v1 Identifier}}'''$v1''' returns the value of the left-hand operand of the most recently executed conditional statement. This identifier is equivalent to the deprecated {{mIRC|$ifmatch}} identifier. | |
− | ==Synopsis== | + | |
+ | == Synopsis == | ||
<pre>$v1</pre> | <pre>$v1</pre> | ||
− | ==Examples== | + | == Parameters == |
+ | None | ||
+ | |||
+ | == Properties == | ||
+ | None | ||
+ | |||
+ | == Notes == | ||
+ | Just like $ifmatch, $v2 and $ifmatch2, this identifier returns one of the operands from the last conditional statement executed. Conditional statements include: | ||
+ | * {{mirc|/if}} | ||
+ | * {{mirc|$iif}} | ||
+ | * {{mirc|/while}} | ||
+ | |||
+ | <source lang="mIRC"> | ||
+ | alias test return $iif($1 == 1,1,2) | ||
+ | alias testing if (a != b) echo -a $test(1) $v1 | ||
+ | </source> | ||
+ | This will echo 1 for $v1 instead of "a" because $test is evaluated before $v1, so the $iif is the last statement made when $v1 evaluates. | ||
+ | |||
+ | == Examples == | ||
List the names of any hash tables currently in use upon calling an alias '''/hlist''': | List the names of any hash tables currently in use upon calling an alias '''/hlist''': | ||
<source lang="mirc">alias hlist { | <source lang="mirc">alias hlist { | ||
Line 16: | Line 35: | ||
echo -qgaec i End of /hlist. | echo -qgaec i End of /hlist. | ||
}</source> | }</source> | ||
− | |||
Check if two random numbers between 1 and 5 are equivalent, and echo the matching numbers if so: | Check if two random numbers between 1 and 5 are equivalent, and echo the matching numbers if so: | ||
<source lang="mirc">//echo -ga $iif($rand(1,5) == $rand(1,5),Yes! $v1 == $v2,No! $v1 != $v2) $+ !</source> | <source lang="mirc">//echo -ga $iif($rand(1,5) == $rand(1,5),Yes! $v1 == $v2,No! $v1 != $v2) $+ !</source> | ||
− | ==Compatibility== | + | == Compatibility == |
− | + | {{mIRC compatibility|6.16}} | |
− | |||
− | |||
− | ==See | + | == See also == |
*[[Conditional statements - mIRC|If then else]] | *[[Conditional statements - mIRC|If then else]] | ||
− | * | + | *{{mIRC|While loops}} |
− | * | + | *{{mIRC|$v2}} |
− | * | + | *{{mIRC|$ifmatch}} |
− | * | + | *{{mIRC|$ifmatch2}} |
+ | *{{mirc|/if}} | ||
+ | *{{mirc|$iif}} | ||
+ | *{{mirc|/while}} | ||
+ | {{mIRC identifier list}} | ||
− | [[Category: | + | [[Category:mIRC identifiers|v1]] |
Latest revision as of 17:12, 22 September 2017
$v1 returns the value of the left-hand operand of the most recently executed conditional statement. This identifier is equivalent to the deprecated $ifmatch identifier.
Synopsis[edit]
$v1
Parameters[edit]
None
Properties[edit]
None
Notes[edit]
Just like $ifmatch, $v2 and $ifmatch2, this identifier returns one of the operands from the last conditional statement executed. Conditional statements include:
alias test return $iif($1 == 1,1,2) alias testing if (a != b) echo -a $test(1) $v1
This will echo 1 for $v1 instead of "a" because $test is evaluated before $v1, so the $iif is the last statement made when $v1 evaluates.
Examples[edit]
List the names of any hash tables currently in use upon calling an alias /hlist:
alias hlist { if (!$hget(0)) { echo -qgaec i * No hash tables in use } else { var %i 1 while ($hget(%i) != $null) { echo -ga $v1 } } echo -qgaec i End of /hlist. }
Check if two random numbers between 1 and 5 are equivalent, and echo the matching numbers if so:
//echo -ga $iif($rand(1,5) == $rand(1,5),Yes! $v1 == $v2,No! $v1 != $v2) $+ !
Compatibility[edit]
Added: mIRC v6.16
Added on: 07 Jul 2004
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.