+ 6
Can I conclude that bool can even analyze strings as true or false?
https://www.sololearn.com/discuss/550449/?ref=app The following problem I had the day before yesterday was solved only when I interchanged the bool and the int parameters in the first constructor... Thus I think that the bool data type was also reading strings and analyzing it, as the 1st constructor was being invoked... So, why is this happening? How does bool analyze a string as true or false? Is it based on size? Or on first character?
4 Réponses
+ 11
any value that is not 0 is considered true.
+ 5
@jay
Wow. Even an empty string is shown as true...
+ 4
@Jay
Ok. So what string can be rendered false?