JScript statement

xiaoxiao2021-03-06  14

Can't write across banks:

______________________________________

The suffix increment and decrement operators must be displayed in the same line with their parameters. For example, x and i--. Keyword Continue and Break must be displayed in the same line with their labels. For example, Continue Label1 and Break Label2. Keyword Return and Throw must be displayed in the same line with their expressions. For example, Return (X Y) and Throw "Error 42". It must be displayed in the same row with a declaration to be modified unless the custom property is with a modifier. For example myattribute class myclass. ________________________________________

Although not required to explicitly terminate the statement at the end of the line, most JScript .NET examples provided here are explicitly terminated. This is done by the semicolon (;), the semicolon is the termination character of the JScript statement.

The same C style.

{}

form.

_______________________________________________

IF .... else

With C style:

It is usually a good practice in the braces ({}) in braces ({}), which is clear and can avoid incorrectly caused.

Example:

IF (x == 5) {if (y == 6) z = 17;} else z = 20; ______________________________________

Three-yuan operator:

?: The operator can be used as a shortcut for the IF ... ELSE statement. It is usually used as part of a large expression (using the if ... ELSE statement.) E.g:

Var now = new date ();

Var greeting = "good" (now.getHours ()> 17)? "eVening.": "day.");

In this example, if you are late 6, a string containing "Good evening." Is created. The equivalent code of the IF ... ELSE statement is as follows:

Var now = new date ();

Var greeting = "good";

IF (now.gethai ()> 17)

Greeting = "EVENING."

Else

Greeting = "DAY."

转载请注明原文地址:https://www.9cbs.com/read-47224.html

New Post(0)