How to do it...

  1. Create a state variable to store Boolean values in the contract. Use the bool keyword and initialize it using either true or false. The Boolean type supports basic operators such as - !, &&, !!, ==, and !=:

bool isAvailable = false;
  1. To create a variable to store integer values using either int or uint keyword, use int to store unsigned integers and uint to store signed integers of various memory sizes. You can store integers ranging from uint8/int8 to uint256/int256 in steps of 8:
// uint/int are aliases for uint256/int256uint256 a = 9607111;int32 b = 102;

Use the following supported operators to perform comparisons or arithmetic operations:

  • Comparisons: <=, <, ==, !=, >=, >
  • Bit operators: &, |, ^ (bitwise exclusive ...

Get Ethereum Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.