CDE
This commit is contained in:
parent
518da4a923
commit
764da6cbbb
6144 changed files with 83610 additions and 11 deletions
|
|
@ -0,0 +1,2 @@
|
|||
( condition ) IF ( true statements ) THEN
|
||||
( condition ) IF ( true statements ) ELSE ( false statements ) THEN
|
||||
|
|
@ -0,0 +1 @@
|
|||
10 < IF ." Less than 10" ELSE ." Greater than or equal to 10" THEN
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
( n -- ) CASE
|
||||
( integer ) OF ( statements ) ENDOF
|
||||
( integer ) OF ( statements ) ENDOF
|
||||
( default instructions )
|
||||
ENDCASE
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
: test-case ( n -- )
|
||||
CASE
|
||||
0 OF ." Zero!" ENDOF
|
||||
1 OF ." One!" ENDOF
|
||||
." Some other number!"
|
||||
ENDCASE ;
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
: switch
|
||||
CREATE ( default-xt [count-xts] count -- ) DUP , 0 DO , LOOP ,
|
||||
DOES> ( u -- ) TUCK @ MIN 1+ CELLS + @ EXECUTE ;
|
||||
|
||||
:NONAME ." Out of range!" ;
|
||||
:NONAME ." nine" ;
|
||||
:NONAME ." eight" ;
|
||||
:NONAME ." seven" ;
|
||||
:NONAME ." six" ;
|
||||
:NONAME ." five" ;
|
||||
:NONAME ." four" ;
|
||||
:NONAME ." three" ;
|
||||
:NONAME ." two" ;
|
||||
:NONAME ." one" ;
|
||||
:NONAME ." zero" ;
|
||||
10 switch digit
|
||||
|
||||
8 digit \ eight
|
||||
34 digit \ Out of range!
|
||||
Loading…
Add table
Add a link
Reference in a new issue