diff options
-rw-r--r-- | julia.html.markdown | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/julia.html.markdown b/julia.html.markdown index 220b52a4..ef3ea244 100644 --- a/julia.html.markdown +++ b/julia.html.markdown @@ -103,6 +103,11 @@ false # Printing is easy println("I'm Julia. Nice to meet you!") +# String can be compared lexicographically +"good" > "bye" # => true +"good" == "good" # => true +"1 + 2 = 3" == "1 + 2 = $(1+2)" # => true + #################################################### ## 2. Variables and Collections #################################################### @@ -391,6 +396,14 @@ end add(5, 6) # => 11 after printing out "x is 5 and y is 6" +# Compact assignment of functions +f_add(x, y) = x + y # => "f (generic function with 1 method)" +f_add(3, 4) # => 7 + +# Function can also return multiple values as tuple +f(x, y) = x + y, x - y +f(3, 4) # => (7, -1) + # You can define functions that take a variable number of # positional arguments function varargs(args...) |