summaryrefslogtreecommitdiffhomepage
path: root/julia.html.markdown
diff options
context:
space:
mode:
author0u0 <inkydragon@users.noreply.github.com>2018-08-31 09:46:52 +0800
committer0u0 <inkydragon@users.noreply.github.com>2018-08-31 09:46:52 +0800
commit749e81ace2cf75710926cc0e9e35a8a675545648 (patch)
tree70045fff7253fdfcff4a2efa6f01a0df44ac122d /julia.html.markdown
parent4fcac31e9cfe169f006244dbdb01d0d16fa696e5 (diff)
Uniform output format
Diffstat (limited to 'julia.html.markdown')
-rw-r--r--julia.html.markdown30
1 files changed, 13 insertions, 17 deletions
diff --git a/julia.html.markdown b/julia.html.markdown
index 54860fca..fa614992 100644
--- a/julia.html.markdown
+++ b/julia.html.markdown
@@ -369,19 +369,17 @@ for animal = ["dog", "cat", "mouse"]
println("$animal is a mammal")
# You can use $ to interpolate variables or expression into strings
end
-# prints:
-# dog is a mammal
-# cat is a mammal
-# mouse is a mammal
+# => dog is a mammal
+# => cat is a mammal
+# => mouse is a mammal
# You can use 'in' instead of '='.
for animal in ["dog", "cat", "mouse"]
println("$animal is a mammal")
end
-# prints:
-# dog is a mammal
-# cat is a mammal
-# mouse is a mammal
+# => dog is a mammal
+# => cat is a mammal
+# => mouse is a mammal
for pair in Dict("dog" => "mammal", "cat" => "mammal", "mouse" => "mammal")
from, to = pair
@@ -405,11 +403,10 @@ let x = 0
x += 1 # Shorthand for x = x + 1
end
end
-# prints:
-# 0
-# 1
-# 2
-# 3
+# => 0
+# => 1
+# => 2
+# => 3
# Handle exceptions with a try/catch block
try
@@ -502,10 +499,9 @@ end
# => all_the_args (generic function with 2 methods)
all_the_args(1, 3, keyword_arg=4)
-# prints:
-# normal arg: 1
-# optional arg: 3
-# keyword arg: 4
+# => normal arg: 1
+# => optional arg: 3
+# => keyword arg: 4
# Julia has first class functions
function create_adder(x)