14.16 Boolean expressions
来源:互联网 发布:讲人工智能的电影 编辑:程序博客网 时间:2024/05/17 01:52
A boolean-expression is an expression that yields a result of type bool.
boolean-expression:
expression
The controlling conditional expression of an if-statement (?5.7.1),
while-statement (?5.8.1), do-statement
(?5.8.2), or for-statement (?5.8.3) is a boolean-expression. The
controlling conditional expression of the
?: operator (?4.12) follows the same rules as a boolean-expression, but
for reasons of operator precedence
is classified as a conditional-or-expression.
A boolean-expression is required to be of a type that can be implicitly
converted to bool or of a type that
implements operator true. [Note: As required by ?7.9.1, any type that
implements operator true
must also implement operator false. end note] If neither requirement is
satisfied, a compile-time error
occurs.
When a boolean expression is of a type that cannot be implicitly converted
to bool but does implement
operator true, then following evaluation of the expression, the operator
true implementation
provided by that type is invoked to produce a bool value.
[Note: The DBBool struct type in ?8.4.2 provides an example of a type that
implements operator true
and operator false. end note]
boolean-expression:
expression
The controlling conditional expression of an if-statement (?5.7.1),
while-statement (?5.8.1), do-statement
(?5.8.2), or for-statement (?5.8.3) is a boolean-expression. The
controlling conditional expression of the
?: operator (?4.12) follows the same rules as a boolean-expression, but
for reasons of operator precedence
is classified as a conditional-or-expression.
A boolean-expression is required to be of a type that can be implicitly
converted to bool or of a type that
implements operator true. [Note: As required by ?7.9.1, any type that
implements operator true
must also implement operator false. end note] If neither requirement is
satisfied, a compile-time error
occurs.
When a boolean expression is of a type that cannot be implicitly converted
to bool but does implement
operator true, then following evaluation of the expression, the operator
true implementation
provided by that type is invoked to produce a bool value.
[Note: The DBBool struct type in ?8.4.2 provides an example of a type that
implements operator true
and operator false. end note]
- 14.16 Boolean expressions
- Boolean Expressions
- Boolean Expressions
- Boolean Expressions
- Boolean Expressions
- Boolean Expressions
- Boolean Expressions
- Boolean expressions
- pku 2106 Boolean Expressions
- poj 2106 Boolean Expressions
- poj 2106.Boolean Expressions
- POJ 2106 Boolean Expressions
- POJ 2106 Boolean Expressions
- POJ2106 Boolean Expressions
- 递归之 Boolean Expressions
- Boolean Expressions POJ
- poj 2106 Boolean Expressions
- ZOJ2483 Boolean Expressions
- 14.13.2 Compound assignment
- 14.13.3 Event assignment
- JAVA学习笔记(二)-面向对象程序设计
- 14.14 Expression
- 14.15 Constant expressions
- 14.16 Boolean expressions
- JAVA学习笔记(三)-用户界面设计
- 15. Statements
- 15.1 End points and reachability
- 15.2 Blocks
- 15.3 The empty statement
- 15.4 Labeled statements
- .net中有效验证的三种方法
- JAVA学习笔记(五)-文件和安全性