Forgot to commit
[mono.git] / mcs / docs / ecma334 / 14.9.xml
1 <?xml version="1.0"?>
2 <clause number="14.9" title="Relational and type-testing operators">
3   <paragraph>The ==, !=, &lt;, &gt;, &lt;=, &gt;=, is and as operators are called the relational and type-testing operators. <grammar_production><name><non_terminal where="14.9">relational-expression</non_terminal></name> : <rhs><non_terminal where="14.8">shift-expression</non_terminal></rhs><rhs><non_terminal where="14.9">relational-expression</non_terminal><terminal>&lt;</terminal><non_terminal where="14.8">shift-expression</non_terminal></rhs><rhs><non_terminal where="14.9">relational-expression</non_terminal><terminal>&gt;</terminal><non_terminal where="14.8">shift-expression</non_terminal></rhs><rhs><non_terminal where="14.9">relational-expression</non_terminal><terminal>&lt;=</terminal><non_terminal where="14.8">shift-expression</non_terminal></rhs><rhs><non_terminal where="14.9">relational-expression</non_terminal><terminal>&gt;=</terminal><non_terminal where="14.8">shift-expression</non_terminal></rhs><rhs><non_terminal where="14.9">relational-expression</non_terminal><keyword>is</keyword><non_terminal where="11">type</non_terminal></rhs><rhs><non_terminal where="14.9">relational-expression</non_terminal><keyword>as</keyword><non_terminal where="11">type</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="14.9">equality-expression</non_terminal></name> : <rhs><non_terminal where="14.9">relational-expression</non_terminal></rhs><rhs><non_terminal where="14.9">equality-expression</non_terminal><terminal>==</terminal><non_terminal where="14.9">relational-expression</non_terminal></rhs><rhs><non_terminal where="14.9">equality-expression</non_terminal><terminal>!=</terminal><non_terminal where="14.9">relational-expression</non_terminal></rhs></grammar_production></paragraph>
4   <paragraph>The is operator is described in <hyperlink>14.9.9</hyperlink> and the as operator is described in <hyperlink>14.9.10</hyperlink>. </paragraph>
5   <paragraph>The ==, !=, &lt;, &gt;, &lt;= and &gt;= operators are comparison operators. For an operation of the form x op y, where op is a comparison operator, overload resolution (<hyperlink>14.2.4</hyperlink>) is applied to select a specific operator implementation. The operands are converted to the parameter types of the selected operator, and the type of the result is the return type of the operator. </paragraph>
6   <paragraph>The predefined comparison operators are described in the following sections. All predefined comparison operators return a result of type <keyword>bool</keyword>, as described in the following table. <table_line>Operation Result </table_line>
7 <table_line>x == y true if x is equal to y, false otherwise </table_line>
8 <table_line>x != y true if x is not equal to y, false otherwise </table_line>
9 <table_line>x &lt; y true if x is less than y, false otherwise </table_line>
10 <table_line>x &gt; y true if x is greater than y, false otherwise </table_line>
11 <table_line>x &lt;= y true if x is less than or equal to y, false otherwise </table_line>
12 <table_line>x &gt;= y true if x is greater than or equal to y, false otherwise </table_line>
13 </paragraph>
14 </clause>