Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Untested
- ; Returns the value (V) following the FIRST true conditional (C).
- ; If no conditionals are true, returns final parameter (E) if $0 is odd, else $null
- ; Syntax: $ieif(C1,V1[,C2,V2,C3,...][,E])
- /*
- Examples: {
- $ieif(3 == 1,x,3 == 2,y,3 == 3,z) = z
- $ieif(3 == 3,x,2 == 2,y) = x
- $ieif(3 == 1,x,3 == 2,y,z) = z
- $ieif(3 == 1,x,3 == 2,y) = $null
- }
- */
- alias ieif {
- var %c 1, %v 2
- while (%v <= $0) {
- if ( [ $ [ $+ %c ] ] ) return [ $ [ $+ %v ] ]
- inc %c 2
- inc %v 2
- }
- elseif ($0 \\ 2) return [ $ [ $+ $0 ] ]
- else return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement