; Lazy evaluation of multiple 'if-s.
Ifs: function [Ifs [block!] /Default Case [block!]] [Block] [
while [not empty? Ifs] [
Block: do/next Ifs
if first Block [return do first second Block]
Ifs: next second Block
]
if Default [return do Case]
none
]
print Ifs/Default [
X < 0 [-1]
X = 0 [0]
(0 < X) and (X < 10) [+1]
] ["Much bigger!"]
It's a lot like Ladislav's version.
Andrew Martin
ICQ: 26227169
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
-><-
- [REBOL] wanna help me "cheat?" tf
- [REBOL] wanna help me "cheat?" Re: tf
- [REBOL] Polymorphic lmecir
- [REBOL] Polymorphic Re:(4) Al . Bri
- [REBOL] Polymorphic Re:(4) lmecir
- [REBOL] Polymorphic Re:(5) lmecir
- [REBOL] Polymorphic Re:(6) joel . neely
- [REBOL] Polymorphic Re:(7) Al . Bri
- [REBOL] Re: Polymorphic Re:(6) giesse
- [REBOL] Polymorphic Re:(8) joel . neely
- [REBOL] Polymorphic Re:(4) lmecir
- [REBOL] Polymorphic Re: joel . neely
