summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndre Polykanine <ap@oire.me>2019-02-01 01:40:57 +0200
committerGitHub <noreply@github.com>2019-02-01 01:40:57 +0200
commita1d30f2717d978fe165a673580631bb943460f95 (patch)
treebc1a474fd22a3ee52e5a3e1ad8a7aa92bee27ee3
parentcc02eceaeae0708829b0e108f05c0056749e0c63 (diff)
parentacc52c21e134e4c47f589a2b83fe0152b0a30e67 (diff)
Merge pull request #3451 from oxinabox/patch-2
[julia/en] tweak order of string functions / print functions
-rw-r--r--julia.html.markdown15
1 files changed, 8 insertions, 7 deletions
diff --git a/julia.html.markdown b/julia.html.markdown
index 69b6aa0c..eabb988e 100644
--- a/julia.html.markdown
+++ b/julia.html.markdown
@@ -93,21 +93,22 @@ ascii("This is a string")[1]
# Julia indexes from 1
# Otherwise, iterating over strings is recommended (map, for loops, etc).
+# String can be compared lexicographically
+"good" > "bye" # => true
+"good" == "good" # => true
+"1 + 2 = 3" == "1 + 2 = $(1 + 2)" # => true
+
# $ can be used for string interpolation:
"2 + 2 = $(2 + 2)" # => "2 + 2 = 4"
# You can put any Julia expression inside the parentheses.
+# Printing is easy
+println("I'm Julia. Nice to meet you!") # => I'm Julia. Nice to meet you!
+
# Another way to format strings is the printf macro from the stdlib Printf.
using Printf
@printf "%d is less than %f\n" 4.5 5.3 # => 5 is less than 5.300000
-# Printing is easy
-println("I'm Julia. Nice to meet you!") # => 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