aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/tests/test-quotations.frt
blob: 87c99d558d32989ae0c82474470c1282c69ae77a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
\ anonymous definitions in a definition

: if-else ( ... f xt1 xt2 -- ... )
\ Postscript-style if-else
    rot if
       drop
    else
       nip
    then
    execute ;

: test ( f -- )
    [: ." true" ;]
    [: ." false" ;]
    if-else ;
   
1 test cr \ writes "true"
0 test cr \ writes "false"