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

[ColorForth] More newbie questions


I've finally been able to start learning/experimenting with colorForth again and it's taken me only a few minutes to run into another beginner question: How does "if" work? Yes, I've read the definition that it jumps to then if the zero flag is set. But how does one set the zero flag? I would assume by the number zero being the top item on the stack, but that doesn't seem to do it. For example, using the following word:

[R]iftest [G] if 1 ; then 0 ;

I would expect "4 iftest" to leave a 1 on the stack and "0 iftest" to leave a 0 on the stack. However, it actually returns "4 0" and "0 0". It's clear that I'm missing something simple. It seems that "if" does not consume the value on the stack, which would make sense if it's actually using a zero flag somewhere as the switch. All guidance will be appreciated.

Also, what does the word "?" do? The documentation isn't clear to me for this word either.

Thanks,
------------------------

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