RosettaCodeData/Task/Integer-comparison/LiveCode/integer-comparison.livecode

21 lines
797 B
Plaintext

ask question "Enter 2 numbers (comma separated)" with empty titled "Enter 2 numbers"
if it is not empty then
put item 1 of it into num1
put item 2 of it into num2
if isnumber(num1) and isnumber(num2) then
if num1 < num2 then answer num1 && "is less than" && num2
if num1 is num2 then answer num1 && "is equal to" && num2
if num1 > num2 then answer num1 && "is greater than" && num2
-- alternative is to use switch case construct
switch
case (num1 < num2)
answer num1 && "is less! than" && num2; break
case (num1 > num2)
answer num1 && "is greater! than" && num2; break
case (num1 = num2)
answer num1 && "equal! to" && num2
end switch
end if
end if