Last active 1759255931

An example of adding basic variable bindings and binary math expressions to Nova.

Revision 9fb38b7b3c299d4cc3e3355bd2facf9f185b46a9

variables.nv Raw Playground
1||:: foo = bar
2 :: bar = baz
3 :: baz = 2
4 :: quux = foo
5 :: baz = bar + foo
6 :: baz = baz + quux
7 :: baz = baz + baz
8
9|:: $x = $y $op $z :@math: $|
10 :: $x = $
11
12|:: $x = $y + $z? :unbound: ($z $y)| :@math: add $y $z
13|:: $x = $y - $z? :unbound: ($z $y)| :@math: subtract $y $z
14|:: $x = $y * $z? :unbound: ($z $y)| :@math: multiply $y $z
15|:: $x = $y / $z? :unbound: ($z $y)| :@math: divide $y $z
16
17|:: $x = $y $op $z :variable: $y $|
18 :: $x = $ $op $z
19|:: $x = $y $op $z? :unbound: $y|
20
21|:: $x = $y $op $z :variable: $z $|
22 :: $x = $y $op $
23|:: $x = $y $op $z? :unbound: $z|
24
25|:: $x = $y $op $z?|
26 :: get $y
27 :: get $z
28
29|:: $x = $y :unbound: $y|
30 :: set $x to $y
31|:: $x = $y :variable: $y $|
32 :: $x = $
33|:: $x = $y?|
34 :: get $y
35
36|:: get $x :variables: $x $y?|
37 :variable: $x $y
38 :: reset variables
39|:: get $x? :variables: $ $y|
40 :skipped: $ $y
41|:: get $x|
42 :unbound: $x
43 :: reset variables
44
45|:: set $x to $y :variables: $x $|
46 :variables: $x $y
47 :: reset variables
48|:: set $x to $y? :variables: $n $|
49 :skipped: $n $
50|:: set $x to $y|
51 :variables: $x $y
52 :: reset variables
53
54|:: reset variables? :skipped: $x $y|
55 :variables: $x $y
56|:: reset variables|
57
58|:: clear variables? :variables: $x $y|
59|:: clear variables|