aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/tests/quotations-test.frt
blob: 26057a888443dc25e252636139afc1ea38c4a13d (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"