home .. forth .. colorforth mail list archive ..

[ColorForth] Question regarding if


Hello,

I want to write a word that test the TOS for a non-zero value. I have tried

: tst if 1 ; then 2 ;
: foo 0 tst 1 tst ;

Execution of foo leaves 0 2 1 2 on the stack, i.e. pushing a constant does not 
seem to affect the flags. Is this expected behavior?

As a workaround I do
: tst 0 or if 1 ; then 2 ;

Does anyone have a better idea?

Cheers,

	Alex

------------------------

To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems   -   List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site   -   http://www.colorforth.com
Wiki page http://kristopherjohnson.net/wiki/ColorForth
ColorForth index http://www.users.qwest.net/~loveall/c4index.htm