Objective-c Operators and expressions

Source: Internet
Author: User
Tags bitwise operators

Operators can be divided into the following types:

Arithmetic operators: +,-, *,/,%,++,—-。

Relational operators: <,>,<=,>=,==,!=

Boolean logical operators:! , &&,| |

Bitwise operator:|,&,^,~,>>,<<

Assignment operators: + =,-=, *=, =/

Conditional operator:?:

Attention:

1. There are two more special operator symbols in the boolean logical operators, "&&" and "| |".

Where the "&&" is short-circuited and if the two expressions are computed, if the value of the first expression is false, it is independent of the value of the second expression and the result is definitely false, so that the second expression is no longer evaluated.

"| |" For short-circuiting or, if two expressions are evaluated, if the value of the first expression is true, the structure must be true, regardless of the value of the second expression, so the second expression is no longer evaluated.

2. Examples of bitwise operators:

3. Conditional operators

The format is: boolean expression? Expression 1: Expression 2

When the value of a Boolean expression is true, the value of expression 1 is returned, otherwise the value of expression 2 is returned.

Objective-c Operators and expressions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.