Hi Tim,
If you want to use switch you could try something like this
my-blk: ["one" "two" "three"]
switch/default form type? my-blk [
"block" [print "block!"]
"string" [print "string!"]
][print "not a string or a block"]
Cheers,
Allen K
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 23, 2000 1:07 PM
Subject: [REBOL] [REBOL] Evaluating Rebol Data Types with a switch
> Thanks Allen:
> the following is what I was looking for:
> my-blk: ["one" "two" "three"]
> either block? my-blk
> [print "yup"]
> [print "nope"]
> BUT: Now I have tried switch with no luck
> ; code I tried is below
> my-blk: ["one" "two" "three"]
> switch my-blk
> [
> block? [print "block!"]
> string? [print "else!"]
> ]
> == none
> At 10:58 AM 4/23/00 +1000, you wrote:
> >
> >Hi Tim,
> >
> >With all types there is an evaluator for the type. It is the data-type's
> >name with a "?" on the end.
> >e.g
> >
> >block? ["one" "two" "three"]
> >==true
> >
> >block? http://www.rebol.com
> >==false
> >
> >url? http://www.rebol.com
> >==true
> >
> >Hope that helps.
> >
> >Cheers,
> >
> >Allen K
> >
> >
> >----- Original Message -----
> >From: <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Sunday, April 23, 2000 10:18 AM
> >Subject: [REBOL] [REBOL] Evaluating Rebol Data Types
> >
> >
> >> Hello Again:
> >> I want to be able to internally evaluate
> >> rebol data types:
> >> the following code :
> >>
> >> my-blk: ["one" "two" "three"]
> >> print reform ["my-blk is a " type? my-blk]
> >> either equal? type? proj-args "block"
> >> [print "my-blk's type is block"]
> >> [print "my-blk's type is something else"]
> >>
> >> ; returns
> >> my-blk is a block
> >> my-blk's type is something else
> >>
> >> ; It appears that
> >> either equal? [type? proj-args] "block"
> >> ; evaluates as false.
> >>
> >> How may I rewrite this code so that it evaluates
> >> as true?
> >>
> >> Thanks in advance
> >> tim
> >>
> >>
> >
> >
>
>