REBOL [
    title: "Enhanced SWITCH Function"
    author: "Christopher Ross-Gill"
    date: 25-Nov-2006
    comment: {From RAMBO discussion group on Rebol3 AltME world.}
]

switch: func [value cases /default case][
    default: make block! []
    while [cases: find/tail cases value][
        either cases: find cases block! [
            case: append default first cases
        ][break]
    ]
    do case
]

switch: func [value cases /default case][
    default: make block! []
    parse cases [
        any [
            thru value to block! set case block!
            (case: append default case)
        ]
    ]
    do case
]