[REBOL] Re: index? none
From: joel:neely:fedex at: 28-Nov-2002 11:55
Hi, Ted,
Ted Landis wrote:
> How do I best avoid the error possible in the following:
>
> index? find block x
>
> When x is not in block it returns none and index? returns an error.
>
It depends on what you want to do ...
a) with the index value
b) when the target value isn't found
... but here's one possibility ...
either found? here: find block x [
... index? here ... ;; handle located value
][
... ;; handle the not-found case
]
... and another ...
index? any [find block x tail block]
(e.g. when you want to append not-found values to the block)
HTH!
-jn-
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]