From WikiChip
$iif Identifier - mIRC
< mirc‎ | identifiers
Revision as of 00:41, 14 November 2017 by Maroonbells (talk | contribs) (Create content for identifier)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

$iif returns a conditional value depending on whether a conditional statement resolves to $true or $false.

Synopsis

$iif(C,T [,F] )

Parameters

  • C - A conditional statement that determines whether this identifier returns the $true or $false conditional.
  • T - The string returned and/or identifier executed if the C statement is $true
  • F - Optional string returned and/or identifier executed if the C statement is $false

Note: If F parameter is not used, $iif returns $null if the C statement is $false
Note: If C evaluates to $false or $null or 0 (including 000 or 0.00), it is $false, $true or non-zero or text strings are $true

Properties

None

Example

//echo -a $iif(0,$custom1(true1),$custom2(false2)) / $v1 $v2
 = calls the custom2 identifier and returns any string returned by it. $v1 is filled with the 1st term of the C condition.
//echo -a $iif(2 > 1,$custom1(true1),$custom2(false2)) / $v1 $v2
 = calls the custom1 identifier and returns any string returned by it. $v1 is filled with 2 (the 1st term of the C condition) and $v2 is filled with 1 (the 2nd term of C).
//echo -a echo -a today: $iif($asctime($ctime,ddd) isin MonTueWedThuSat,Weekday,Weekend)
//echo -a echo -a today: $iif($asctime($ctime,ddd) isin MonTueWedThuSat,Weekday)
  1st of the pair returns either Weekday or Weekend
  2nd of the pair returns either Weekday or $null because of the missing F parameter.
  $iif conditionals can be nested:
//echo -a Classes on the $iif($asctime($ctime,ddd) isin SatSun,Sat-Sun, $iif(T* iswm $asctime($ctime,ddd),Tue-Thur,Mon-Wed-Fri)) Schedule meet today

Compatibility

Added: mIRC v5.4
Added on: 23 Jun 1998
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See Also