Integer comparison: Difference between revisions
Content added Content deleted
m (added a ;Related task: (bold) header, added other whitespace to the task's preamble.) |
(Added FutureBasic example) |
||
Line 1,134: | Line 1,134: | ||
} |
} |
||
}</lang> |
}</lang> |
||
=={{header|FutureBasic}}== |
|||
Note: Strictly speaking, it's preferable to use "==" when comparing integers as seen in this example. While the "=" sign will work as a comparison in most cases, technically it should be used for assignment, i.e. a = 3 when a is assigned the value of 3, as contrasted with a == 3, where the value of a is being compared with 3. FB will flag a warning when "==" is used to compare two single, doubles or floats since comparing real numbers can be inaccurate. |
|||
<lang futurebasic> |
|||
include "ConsoleWindow" |
|||
dim as long n1, n2 |
|||
input "Enter two numbers (separated by a comma) to compare: "; n1, n2 |
|||
if n1 < n2 then print : print n1; " is less than"; n2 |
|||
if n1 > n2 then print : print n1; " is greater than"; n2 |
|||
if n1 == n2 then print : print n1; " equals"; n2 |
|||
</lang> |
|||
=={{header|Groovy}}== |
=={{header|Groovy}}== |