OILS / spec / testdata / module2 / closure.ysh View on Github | oilshell.org

26 lines, 18 significant
1
2const __provide__ = :| {global,local,default}_expr {global,local,default}_block |
3
4var g = 'global'
5
6var global_expr = ^["$g!"]
7
8func local_expr() {
9 var lo = 'local'
10 return (^["$[g] $[lo]!"])
11}
12
13var global_block = ^(echo "$[g]!")
14
15func local_block() {
16 var lo = 'local'
17 return (^(echo "$[g] $[lo]!"))
18}
19
20func default_expr(x=^"$g expr!") {
21 return (x)
22}
23
24func default_block(x=^(echo "$g block!")) {
25 return (x)
26}