31 lines
608 B
Plaintext
31 lines
608 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
|
|
|
|
obj <- {
|
|
field <- "hello"
|
|
method <- x -> x * 2
|
|
}
|
|
## Object creation |