SReject commented on a Page, $ieif  -  Aug 11, 2011

My Version:

alias ieif {
  var %x = 1, %b
  while (%x <= $0) {
    %b = $($ $+ %x,2)
    if (2 \\ $0) && ($calc($0 - 2) == %x) {
      return $iif( [ %b ] , [ $(,$ $+ $calc(%x +1),2) ] , [ $(,$ $+ $calc(%x +2),2) ] )
    }
    $iif( [ %b ] ,return [ $(,$ $+ $calc(%x +1),2) ] , inc %x 2)
  }
}

Usage: Same as $iif() except it allows for multiple elseifs.
IE: $ieif(a == a,a,b == b,b,c)

Issues/Bugs:
For things you want evaluated from within the $ieif() you must $(...,0) those items(such as $v1 and $v2)
For things you don't want evaluated at all, you must double escape them. IE: $ieif(a == a,$($!me is testing,0))

Fixes: Fixed the elsepart not evaluting $v1/$v2/$ifmatch/$ifmatch2 properly

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.