Integer comparison: Difference between revisions
Content added Content deleted
Line 1,694: | Line 1,694: | ||
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. |
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> |
<lang futurebasic> |
||
window 1 |
|||
include "ConsoleWindow" |
|||
dim as long n1, n2 |
dim as long n1, n2 |
||
Line 1,703: | Line 1,703: | ||
if n1 > n2 then print : print n1; " is greater than"; n2 |
if n1 > n2 then print : print n1; " is greater than"; n2 |
||
if n1 == n2 then print : print n1; " equals"; n2 |
if n1 == n2 then print : print n1; " equals"; n2 |
||
</lang> |
|||
HandleEvents</lang> |
|||
=={{header|Fōrmulæ}}== |
=={{header|Fōrmulæ}}== |