August 2019
Intermediate to advanced
486 pages
13h 52m
English
Solidity supports the bool data type that can store values such as true or false. A Boolean data type is declared and assigned a bool value, as shown here:
bool isInitialized = false;
If the value of a bool data type is not assigned, its default value will be false.
The following operators are supported on the bool data type—just like all of the other programming languages, unary and binary operators, including short circuit operators (&& and ||), equal (==), not equal (!=), and unary negation (!) operators can be used on the bool data type:
require( ! isInitialized ); //Negation operatorbool isAllowed = isAdmin || isModerator; //Short circuit operatorif( getStatus() == isPending ) { //... }//Equal operator
The preceding ...