Hi, I think, that a mix can easily be achieved as follows:

    cases-dialect: make object! [
        "Dialect for do-cases"
        else-if: if: func [[throw]
            condition
            body [block!]
        ] [
            system/words/if condition [body]
        ]
        else: func [[throw]
            body
        ] [
            body
        ]
    ]

    do-cases: func [ [throw]
        "Executes the case whose condition is true"
    ;   example for cases:
    ;       if cond1 [code1] else-if cond2 [code2] ... else
[default]
        cases [block!]
    ] [
        do any bind cases in cases-dialect 'self
    ]

; this is a code that uses not purely imperative strategy, because
it can return meaningful values, so:

sign4: func [x [number!]] [
    do-cases [
        if x < 0 [-1]
        else-if x = 0 [0]
        else [1]
    ]
]

The only problem here can be with the words, because bind is
necessary to do only because you use 'if and 'else.

Regards,
    Ladislav

> Hello [EMAIL PROTECTED]!
> In conclusion, I don't know which approach is better, so use
> whatever you like (or both...). ;-)
>
> Regards,
>     Gabriele.

Reply via email to