mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 01:51:38 +00:00
Merge pull request #2007 from pranitbauva1997/new
Strings can be lexicographically compared with comparison operators
This commit is contained in:
commit
9bd6e3d10d
@ -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...)
|
||||
|
Loading…
Reference in New Issue
Block a user