diff options
Diffstat (limited to 'counters.mu')
-rw-r--r-- | counters.mu | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/counters.mu b/counters.mu index f3445409..f620ab50 100644 --- a/counters.mu +++ b/counters.mu @@ -1,12 +1,12 @@ # example program: maintain multiple counters with isolated lexical scopes # (spaces) -def new-counter n:number -> default-space:address:array:location [ +def new-counter n:num -> default-space:address:array:location [ default-space <- new location:type, 30 load-ingredients ] -def increment-counter outer:address:array:location/names:new-counter, x:number -> n:number/space:1 [ +def increment-counter outer:address:array:location/names:new-counter, x:num -> n:num/space:1 [ local-scope load-ingredients 0:address:array:location/names:new-counter <- copy outer # setup outer space; it *must* come from 'new-counter' @@ -21,8 +21,8 @@ def main [ b:address:array:location <- new-counter 23 # increment both by 2 but in different ways increment-counter a, 1 - b-value:number <- increment-counter b, 2 - a-value:number <- increment-counter a, 1 + b-value:num <- increment-counter b, 2 + a-value:num <- increment-counter a, 1 # check results $print [Contents of counters], 10/newline $print [a: ], a-value, [ b: ], b-value, 10/newline |