June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,14 +1,16 @@
|
|||
fun main(args): ## Array[Str]
|
||||
let a = "astro"
|
||||
let b = "astro"
|
||||
print
|
||||
..("Case sensitive comparisons:\n")
|
||||
..("astro and astro are equal = $(a == b)")
|
||||
..("astro and astro are not equal = $(a != b)")
|
||||
..("astro comes before astro = $(a < b)")
|
||||
..("astro comes after astro = $(a > b)")
|
||||
..("\nCase insensitive comparisons:\n")
|
||||
..("astro and astro are equal = $(a == b.lower())")
|
||||
..("astro and astro are not equal = $(a != b.lower())")
|
||||
..("astro comes before astro = $(a < b.lower())")
|
||||
..("astro comes after astro = $(a > b.lower())")
|
||||
fun compare(a, b):
|
||||
print("\n$a is of type $(typeof(a)) and $b is of type $(typeof(b))")
|
||||
if a < b: print("$a is strictly less than $b")
|
||||
if a <= b: print("$a is less than or equal to $b")
|
||||
if a > b: print("$a is strictly greater than $b")
|
||||
if a >= b: print("$a is greater than or equal to $b")
|
||||
if a == b: print("$a is equal to $b")
|
||||
if a != b: print("$a is not equal to $b")
|
||||
if a is b: print("$a has object identity with $b")
|
||||
if a is not b: print("$a has negated object identity with $b")
|
||||
|
||||
compare("YUP", "YUP")
|
||||
compare('a', 'z')
|
||||
compare("24", "123")
|
||||
compare(24, 123)
|
||||
compare(5.0, 5)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue