(Created page with "{{mirc title|$v2 Identifier}}The '''$v2''' identifier returns the value of the lefthand operand of the most recently checked conditonal statement within a script. This identif...") |
m (→Notes: Correct typo.) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{mirc title|$v2 Identifier}}The '''$v2''' identifier returns the value of the | + | {{mirc title|$v2 Identifier}}The '''$v2''' identifier returns the value of the right-hand operand of the most recently executed conditional statement. This identifier is equivalent to the deprecated {{mIRC|$ifmatch2}} identifier. |
− | ==Synopsis== | + | |
+ | == Synopsis == | ||
<pre>$v2</pre> | <pre>$v2</pre> | ||
− | == | + | == Parameters == |
+ | None | ||
+ | == Properties == | ||
+ | None | ||
+ | |||
+ | == Notes == | ||
+ | Just like $v1, $ifmatch and $ifmatch2, this identifier return the value from the very 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) $v2 | ||
+ | </source> | ||
+ | This will echo 1 for $v2 because $test is evaluated before $v2, so the $iif is the last statement made when $v2 evaluates. | ||
+ | |||
+ | == Examples == | ||
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]] | ||
*[[While Loops - mIRC|While loops]] | *[[While Loops - mIRC|While loops]] | ||
Line 20: | Line 36: | ||
*{{mIRC|$ifmatch}} | *{{mIRC|$ifmatch}} | ||
*{{mIRC|$ifmatch2}} | *{{mIRC|$ifmatch2}} | ||
+ | *{{mirc|/if}} | ||
+ | *{{mirc|$iif}} | ||
+ | *{{mirc|/while}} | ||
{{mIRC identifier list}} | {{mIRC identifier list}} | ||
− | [[Category: | + | [[Category:mIRC identifiers|v2]] |
Latest revision as of 17:19, 23 February 2024
The $v2 identifier returns the value of the right-hand operand of the most recently executed conditional statement. This identifier is equivalent to the deprecated $ifmatch2 identifier.
Synopsis[edit]
$v2
Parameters[edit]
None
Properties[edit]
None
Notes[edit]
Just like $v1, $ifmatch and $ifmatch2, this identifier return the value from the very last conditional statement executed. Conditional statements include:
alias test return $iif($1 == 1,1,2) alias testing if (a != b) echo -a $test(1) $v2
This will echo 1 for $v2 because $test is evaluated before $v2, so the $iif is the last statement made when $v2 evaluates.
Examples[edit]
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.