Flutter for Beginners
上QQ阅读APP看书,第一时间看更新

Booleans

Dart provides the two well-known literal values for the bool type: true and false.

Boolean types are simple truth values that can be useful for any logic. One thing you may have noticed, but that I want to reinforce, is about expressions.

We already know that operators, such as > or ==, for example, are nothing more than methods with a special syntax defined in classes, and, of course, they have a return value that can be evaluated in conditions. So, the return type of all these expressions is bool and, as you already know, Boolean expressions are important in any programming language.