How to resolve the algorithm Boolean values step by step in the FutureBasic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Boolean values step by step in the FutureBasic programming language

Table of Contents

Problem Statement

Show how to represent the boolean states "true" and "false" in a language. If other objects represent "true" or "false" in conditionals, note it.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Boolean values step by step in the FutureBasic programming language

Source code in the futurebasic programming language

window 1
BOOL boolTest
boolTest = -1
print boolTest
HandleEvents

implicit conversion from constant value -1 to 'BOOL'; the only well defined values for 'BOOL' are YES and NO [-Wobjc-bool-constant-conversion]

void local fn BooleanExercise
  BOOL areEqual    = (1 == 1)      // areEqual is YES
  BOOL areNotEqual = not areEqual  /* areNotEqual is converted to: areEqual = (-(1 == 1)). -1 throws a clang warning.
  NOTE: FB does not accept the "!" shorthand for "not", i.e. !areEqual, common in other languages. */
  
  print "areEqual    == "; areEqual
  print "areNotEqual == "; areNotEqual
  print
  
  // Boolean types assigned values outside YES or NO compile without complaint.
  boolean minusOneTest = -1
  print "minusOneTest == "; minusOneTest
  
  // Typical boolean value is use
  BOOL flatterRosettaReader = YES
  if (flatterRosettaReader)
    print
    print @"Rosetta Code programmers understand booleans."
    print
  end if
  
  // Defined Core Foundation boolean values
  print "kCFBooleanTrue  == "; kCFBooleanTrue
  print "kCFBooleanFalse == "; kCFBooleanFalse
  print
  
  // Number object assigned literal value
  CFNumberRef booleanObject = @(YES)
  print "booleanObject == "; booleanObject
  print
  
  // Number object created programmatically
  booleanObject = NO
  print "booleanObject variable reassigned as N0 == "; fn NumberWithBool( booleanObject )
  print
end fn

window 1

fn BooleanExercise

HandleEvents

  

You may also check:How to resolve the algorithm Loops/Nested step by step in the TUSCRIPT programming language
You may also check:How to resolve the algorithm Sum and product of an array step by step in the SAS programming language
You may also check:How to resolve the algorithm Comma quibbling step by step in the JavaScript programming language
You may also check:How to resolve the algorithm Happy numbers step by step in the C++ programming language
You may also check:How to resolve the algorithm Sieve of Pritchard step by step in the Pascal programming language