summaryrefslogtreecommitdiffhomepage
path: root/julia.html.markdown
diff options
context:
space:
mode:
author0u0 <inkydragon@users.noreply.github.com>2018-08-29 15:55:04 +0800
committer0u0 <inkydragon@users.noreply.github.com>2018-08-29 15:55:04 +0800
commit35215e4a2db7063f105eb30eb19cbf7b9d370cec (patch)
tree2a2c4afab4e44743e5ae13c93e8b849eec3c4bb6 /julia.html.markdown
parente1ab28f4fab138e7968041190a64ef0dc0a346a4 (diff)
Use more clearly example
Diffstat (limited to 'julia.html.markdown')
-rw-r--r--julia.html.markdown10
1 files changed, 5 insertions, 5 deletions
diff --git a/julia.html.markdown b/julia.html.markdown
index 0b28d869..dfa3103c 100644
--- a/julia.html.markdown
+++ b/julia.html.markdown
@@ -28,17 +28,17 @@ This is based on Julia 1.0.0
# Everything in Julia is an expression.
# There are several basic types of numbers.
-3 # => 3 (Int64)
-3.2 # => 3.2 (Float64)
-2 + 1im # => 2 + 1im (Complex{Int64})
-2 // 3 # => 2 // 3 (Rational{Int64})
+typeof(3) # => Int64
+typeof(3.2) # => Float64
+typeof(2 + 1im) # => Complex{Int64}
+typeof(2 // 3) # => Rational{Int64}
# All of the normal infix operators are available.
1 + 1 # => 2
8 - 1 # => 7
10 * 2 # => 20
35 / 5 # => 7.0
-5 / 2 # => 2.5 # dividing integers always results in a Float64
+10 / 2 # => 5.0 # dividing integers always results in a Float64
div(5, 2) # => 2 # for a truncated result, use div
5 \ 35 # => 7.0
2^2 # => 4 # power, not bitwise xor