32 lines
592 B
Plaintext
32 lines
592 B
Plaintext
## Comments
|
|
apple <- 1 ## assignments
|
|
pear() ## function calls
|
|
pear(x, y) ## function calls with arguments
|
|
apple <- pear(x, y) + z ## compound assignments
|
|
foo <- -> bar() ## function definitions
|
|
foo <- ->
|
|
bar()
|
|
baz()
|
|
# functions with block statements
|
|
foo <- x -> y -> x * y + 7 ## Multiple argument functions
|
|
if test?()
|
|
do-something()
|
|
elif other-test?()
|
|
do-something-else()
|
|
else
|
|
a <- 4
|
|
## Block conditionals
|
|
|
|
if test?()
|
|
do-nothing()
|
|
else
|
|
if second-test?()
|
|
do-a-real-bad-thing()
|
|
## Nested blocks
|
|
|
|
i <- 1
|
|
loop until i > 10
|
|
print(i)
|
|
i <- 1
|
|
## Loops
|