Anonymous user
Sort three variables: Difference between revisions
→{{header|Strings}}
Line 496:
: SORT3STRINGS ?SWAPSTR >R ?SWAPSTR R> ?SWAPSTR ;
\ non-destructive print 3 counted-strings from data stack
: .
3 0 DO DUP CR COUNT TYPE ROT LOOP ;
</LANG>
With these extensions we can do the same testing at the Forth console and
examine the string order with '.
<PRE>ok
X Y Z ok
.STRS
lions, tigers, and
(from the "Wizard of OZ")
Line 509 ⟶ 510:
ok
SORT3STRINGS ok
.STRS
(from the "Wizard of OZ")
lions, tigers, and
|