RosettaCodeData/Task/String-comparison/Falcon/string-comparison.falcon

36 lines
978 B
Plaintext

/* created by Aykayayciti Earl Lamont Montgomery
April 9th, 2018 */
e = "early"
l = "toast"
g = "cheese"
b = "cheese"
e2 = "early"
num1 = 123
num2 = 456
> e == e2 ? @ "$e equals $e2" : @ "$e does not equal $e2"
> e != e2 ? @ "$e does not equal $e2": @ "$e equals $e2"
// produces -1 for less than
> b.cmpi(l) == 1 ? @ "$b is grater than $l" : @ "$l is grater than $b"
// produces 1 for greater than
> l.cmpi(b) == 1 ? @ "$l is grater than $b" : @ "$b is grater than $l"
// produces 0 for equal (but could be greater than or equal)
> b.cmpi(g) == 1 or b.cmpi(g) == 0 ? @ "$b is grater than or equal to $g" : @ "$b is not >= $g"
// produces 0 for equal (but could be less than or equal)
>b.cmpi(g) == -1 or b.cmpi(g) == 0 ? @ "$b is less than or equal to $g" : @ "$b is not <= $g"
function NumCompare(num1, num2)
if num1 < num2
ans = " < "
elif num1 > num2
ans = " > "
else
ans = " = "
end
return ans
end
result = NumCompare(num1, num2)
> @ "$num1 $result $num2"