String comparison: Difference between revisions

Line 367:
 
=={{header|Astro}}==
<lang python>fun maincompare(argsa, b): ## Array[Str]
print("\n$a is of type $(typeof(a)) and $b is of type $(typeof(b))")
let a = "astro"
if a < b: print("$a is strictly less than $b") end
let b = "astro"
if a <= b: print("$a is less than or equal to $b") end
print
if a > ..b: print("Case$a sensitiveis comparisons:\nstrictly greater than $b") end
if a >= b: ..print("astro$a andis astrogreater arethan or equal =to $(a == b)") end
if a == b: ..print("astro$a and astro are notis equal =to $(a != b)") end
if a != b: ..print("astro$a comesis beforenot astroequal =to $(a < b)") end
if a is b: ..print("astro$a comeshas afterobject astroidentity =with $(a > b)") end
if a is not b: print("$a has negated object identity with $b") end
..("\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())")
</lang>
 
compare("YUP", "YUP")
compare('a', 'z')
compare("24", "123")
compare(24, 123)
compare(5.0, 5)
 
=={{header|AWK}}==
Anonymous user