diff options
author | bk2dcradle <ankitsultana@gmail.com> | 2016-01-05 13:34:10 +0530 |
---|---|---|
committer | bk2dcradle <ankitsultana@gmail.com> | 2016-01-05 13:34:10 +0530 |
commit | 0e3ed9579b296e276741f06afe8e0a9834672b9e (patch) | |
tree | d01a82820ee8a7fb41583cdbf9119583d3fe8004 /julia.html.markdown | |
parent | a5730e4ab931b8355704d35ee08acef75435bd83 (diff) | |
parent | 4dc5eeda5528047ece4f5798cff6961b0bc21dcb (diff) |
Reset to Adambard's
Diffstat (limited to 'julia.html.markdown')
-rw-r--r-- | julia.html.markdown | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/julia.html.markdown b/julia.html.markdown index cba7cd45..ef3ea244 100644 --- a/julia.html.markdown +++ b/julia.html.markdown @@ -2,6 +2,7 @@ language: Julia contributors: - ["Leah Hanson", "http://leahhanson.us"] + - ["Pranit Bauva", "http://github.com/pranitbauva1997"] filename: learnjulia.jl --- @@ -102,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 #################################################### @@ -390,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...) @@ -723,7 +737,7 @@ code_native(square_area, (Float64,)) # ret # # Note that julia will use floating point instructions if any of the -# arguements are floats. +# arguments are floats. # Let's calculate the area of a circle circle_area(r) = pi * r * r # circle_area (generic function with 1 method) circle_area(5) # 78.53981633974483 |