Script Library: 1238 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Discussion posts for script case.r

1
coccinelle
28-Nov-2005 13:03
REBOL

Case is native function

Contents:

Now case is a native function :

>> help case
USAGE:
     CASE block /all

DESCRIPTION:
     Evaluates each condition, and when true, evaluates what follows it.
     CASE is a native value.

ARGUMENTS:
     block -- Block of cases (conditions followed by values) (Type: block)

REFINEMENTS:
     /all -- Evaluate all cases (do not stop at first true case)

Another case function exists also in the cookbook with the following source :

case: func [  
    "Find a condition and evaluates what follows it."  
    [throw]  
    cases [block!] "Block of cases to evaluate."  
    /default  
        case "Default case if no others are found."  
    /local condition body  
][  
    while [not empty? cases][  
        set [condition cases] do/next cases  
        if condition [  
            body: first cases  
            break  
        ]  
        cases: next cases  
    ]  
    do any [
        body
        case
    ]  
]
MakeDoc2 by REBOL- 28-Nov-2005
2
cmdicely
30-Nov-2005 0:22
Well, that was a waste of time then (not really, it was a good exercise, 
if nothing else). 


Really, though, I needed -- well, wanted --  "case" for something 
I was working on, and thought I had seen it somewhere, but it wasn't 
in the docs I checked on the web, and I didn't even think to check 
the console help or the cookbook.


The worst part is I've realized the version I uploaded originally 
is slightly broken...


Blah. Well, next time I'll have to be more careful not to reinvent 
the wheel.
3
sumnerzzupa
24-May-2021 3:55
REBOL

I experienced that also, what I did is I consulted to some experts here in the forum.

Contents:

Louisville Hood Cleaning

MakeDoc2 by REBOL- 24-May-2021
4
mark214
20-Nov-2021 20:20
REBOL

Thank you for this information. carpet cleaning in fresno

Contents:

MakeDoc2 by REBOL- 20-Nov-2021
5
marie
3-Mar 6:19
REBOL

I find it very interesting and very well thought out and put together. I look forward to reading your work in the future.

Contents:

Adam

MakeDoc2 by REBOL- 3-Mar-2022
6
odonnellmon
16-Mar 10:34
REBOL

Some great topics on here and might I say that I was quite engaged in reading this article. Thanks!

Contents:

foundation repair near me

MakeDoc2 by REBOL- 16-Mar-2022
7
coleafonse
17-Mar 7:12
REBOL

Just visit Google

Contents:

MakeDoc2 by REBOL- 17-Mar-2022