Re: if then else - but why is there no ?else? in colorForth?

Nick Maroudas <[email protected]> Tue, 4 Nov 2008 03:16:54 +0200
Newsgroups gmane.comp.lang.forth.colorforth
Message-ID <[email protected]>
Quoting Albert van der Horst
<[email protected]>:

>... " 
>... " Chuck Moore wanted to have if a meaning by
>... " itself. The same for
>... " then.
>... " --
>... " Albert van der Horst, UTRECHT,THE NETHERLANDS

Nick here:  Interesting to learn that "if" without
'then' might not be a 'syntax error'.  I've just tried
it.  

         n : testif  -1 + -if -1 ; 

That gave -1 for all n.  I tried if then without ';'

     n  : testifthen  -1 +  -if -1  then 1 ;  

That gave 1 if n was positive, but for 0 or negative n
it gave -1 1 together.  Thus acting like 'if ... then
...' ?

Finally tried 'if then' with a ';' to separate them

    n  :  testif;then  -1 +  -if -1 ; then 1 ;  

The semicolon appeared also to separate the two cases, 
yielding 1 for n positive or -1 for 0 and negative n. 
Thus acting like "if ... else ... " ?        

Caritas,

Nick