Hi, one more version handling correctly Return and Exit.

pif: func [[throw]
    {polymorphic if with lazy evaluation and minimal checking}
    args [block!] /local cond blk r result
] [
    result: false
    while [not empty? args] [
        either cond: first r: do/next args [
            either logic? cond [
                r: do/next second r
                if not unset? blk: first r [
                    result: do blk
                ]
            ] [
                result: do cond
            ]
            args: tail args
        ] [
            r: do/next second r
            args: second r
        ]
    ]
    result
]


Reply via email to