[REBOL] Re: [Truth test fails]
From: lmecir:mbox:vol:cz at: 19-May-2004 0:39
Tim Johnson napsal(a):
>I'm seeing unexpected behavior from a truth test in a context.
>Here is the code for the context:
>writer: make object![
> keys: [bold size color family]
> bold: true
> bold-tag: ""
> bold-end-tag: ""
> fix: func[args[block!]][
> foreach [key val] args[
> ?? key
> if not find keys key [
> make error!
> reform[key "is not an acceptable key for htm-writer. Use:" keys]]
> set in self key val
> ]
> ?? bold
> either bold [
> print "creating tag"
> bold-tag: "<b>"
> bold-end-tag: "</b>"
> ][
> print "no tag"
> bold-tag: ""
> bold-end-tag: ""
> ]
> ]
> ]
>Now here is sample code execution:
>
>>>writer/fix [bold false]
>>>
>>>
>key: bold
>bold: false
>creating tag
>== "</b>"
>I would expect that the false-block for 'either
>would be executed.
>
>What am I doing wrong?
>
>thanks
>tim
>
see this:
set [key val] [bold false]
probe key
set key val
probe bold ; == false
type? bold ; == word!
-L