Jump to content

Boolean values: Difference between revisions

m
No edit summary
Line 1,113:
 
=={{header|FutureBasic}}==
FB recognizes two types for boolean truth values: BOOL and boolean. There is a subtle difference between the two. A BOOL will accept without complaint two values, the macros YES, and NO, or the equivalent native FB constants, _true, and _false, and, of course, 0 and 1. However, although a BOOL can be assigned other values, it will throw a clang (FB"s native compiler) warning as with this example:
<syntaxhighlight lang="futurebasic">
window 1
Line 1,125:
implicit conversion from constant value -1 to 'BOOL'; the only well defined values for 'BOOL' are YES and NO [-Wobjc-bool-constant-conversion]
</syntaxhighlight>
On the other hand, a Boolean can be assigned not only YES, NO, _true, or _false, and 0 or 1, but also any integerother valuevalues, such as the common -1, anand compile without complaint.
 
Since FB can also work with objects, native BOOLs and booleans need to be converted to objects as demonstrated in the code below.
Line 1,190:
booleanObject variable reassigned as N0 == 0
</pre>
 
 
 
=={{header|Gambas}}==
721

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.