Dahne Training Third Day notes

Source: Internet
Author: User

1. Operator 1. operator
1) arithmetic operator: +,-, *,/,%,++,--
++/--: Self-increment 1/decrement 1, can be placed before and after variables
1.1) ++/--When used alone, no difference in front
1.2) If the ++/--is used, there is a difference in the former
1.2.1) + + in the rear, first use, then self-increment
1.2.2) + + in front, first self-increment, then use
2) relational operator:> (greater than),< (less than), >= (greater than or equal to), <= (less than or equal to), = = (equals),! = (Not equal)
The result of a relational operation is a Boolean type,
True if the relationship is established, false if the relationship is not valid
3) logical operator:&& (short circuit and), | | (short circuit or),! (Logical non)
& (non-short circuit and), | (non-shorted or)
The logical operation is based on the relational operation,
The result of the logical operation is also the Boolean type
&&amp: Both sides are true and false is False
A short circuit when the first number is false (no subsequent execution)
| |: One side is true and true is True
A short circuit when the first number is true (no subsequent execution)
!: Non-True or false, true
4) assignment Operator: =
Extended assignment operator +=,-=,*=,/=,%=
It is recommended to use the extended assignment operator because of its high efficiency
5) string concatenation: +
+ number If both sides are numbers, do the addition operation
+ If one side is a string, do string concatenation
6) Three mesh operator: Boolean? Number 1: Number of 2
Execution process:
To calculate the Boolean value:
If true, the entire result is 1
If False, the entire result is 2
2. Branching structure: Conditional execution of a statement--------not every word must go
1) If:1 Road
2) If...else:2 Road
3) If...else if: Multiple paths
4) Switch...case: multiple routes
Advantages: Clear structure and high efficiency
Cons: integral type, judged equal
Break: Jump out of Switch...case

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.