TransWikia.com

Numerical Value of Bools in Solidity

Ethereum Asked by DAnsermino on August 26, 2021

What is the numerical value of true and false? Presumably one is 0x0000000000000000 and one is 0x0000000000000001

One Answer

Note that there is no type conversion from non-boolean to boolean types as there is in C and JavaScript, so if (1) { ... } is not valid Solidity. (from the official doc)

but generally a true would be any value !=0;

so you can use :

check = isittrue ? 1 : 0;

Answered by Badr Bellaj on August 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP