When the colon script comes --
In the previous article "what is the description of the programming world brought by JSON", a script design concept has been launched, and there are not many syntax to be defined in the script language. However, it is always necessary to compare the descriptive capabilities of various languages to summarize the final friendly features.
The colon has predefined its assignment function (that is, declaring the name and initializing the specified preset object), but in the new concept, it is discussed as naming assignment and the declaration is meaningful assignment,We will tell future scholars who are good at this language not to make meaningless assignments (I .e. misuse of temporary assignment or copying)The assignment operation is required, but we need to strengthen the role of equal signs. = It is used to describe the value assignment operation, but it appears in the expression calculation and will be interpreted in the computing context. It appears in the conditional expression, if (A = B) we should directly understand whether this represents an equal comparison between the two. Therefore, the value assignment operation, such a modified operation, can only be expressed simply in the form of statements. Such expressions are the best.
Next we will discuss:
I. Block-Level Definition
Ii. Functions of brackets
Block-Level Definition
Curly braces {}, the block organization of this c style has been circulated in the source, and it is used to organize the execution context module, which is used to organize the data structure description type and portray a data object ......
So, we use such a pair of symbols to express what, Below we will simply classify:
1. Organize an object block. It may be a JSON description. Each attribute is separated by commas;
2. Organize a processing block or define a function object. The statements in the block describe independent operations with semicolons.
Functions of parentheses
A programming language basically needs brackets for important expressions. We mentioned that curly brackets are used for organizing statements and JSON objects. There are two pairs of commonly used parentheses, that is, square brackets and parentheses, and angle brackets; it seems that the explanatory language was unearthed very early, but it does not seem to have any angle brackets.
Let's look at their functions in sequence:
Angle brackets: Used in static languages to organize template parameters.
Parentheses: Used in all languages for organizing function parameters; used for expressing priority;
Square brackets: used to describe an array and organize a series of data. An array object is constructed in the script;
Curly braces: As mentioned above, a series of modular functions are organized.
What we want to discuss most here is the key role of parentheses. Without it, the executable context cannot be described.
() Is the most out-of-the-box context. In an expression, the organizational priority is given. In a function definition, the organizational parameters are listed. In a function call, the organizational parameters are listed, it is also used to indicate a function call without a parameter.
In the new interpretation language, we like to reuse the expression form. function () {} is a traditional defined function. What if we need to pass the function object for passing parameters in one call? These function definitions in the closure context are often placed together with the call. Therefore, we prefer to directly append a free block like a function to express the closure area.
This article will be discussed in detail later! Here bye!