Integer comparison: Difference between revisions
Content added Content deleted
(Add Red) |
(added ReScript) |
||
Line 3,219: | Line 3,219: | ||
] |
] |
||
print [a "is" case relation b]</lang> |
print [a "is" case relation b]</lang> |
||
=={{header|ReScript}}== |
|||
<lang ReScript>let my_compare = (a, b) => { |
|||
if a < b { "A is less than B" } else |
|||
if a > b { "A is greater than B" } else |
|||
if a == b { "A equals B" } |
|||
else { "cannot compare NANs" } |
|||
} |
|||
let a = int_of_string(Sys.argv[2]) |
|||
let b = int_of_string(Sys.argv[3]) |
|||
Js.log(my_compare(a, b))</lang> |
|||
{{out}} |
|||
<pre> |
|||
$ bsc compint.res > compint.bs.js |
|||
$ node compint.bs.js 4 2 |
|||
A is greater than B |
|||
$ node compint.bs.js 2 3 |
|||
A is less than B |
|||
$ node compint.bs.js 1 1 |
|||
A equals B |
|||
</pre> |
|||
=={{header|Retro}}== |
=={{header|Retro}}== |