You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For details, refer to the link:#semicolons[Semicolons] chapter.
1008
1008
1009
+
=== Strict Newline Mode
1010
+
1011
+
Since QLExpress4 supports omitting semicolons, the interpreter needs to use newlines to determine whether a statement has ended. Therefore, QLExpress4 has stricter requirements for newlines than QLExpress3.
1012
+
1013
+
The following script is valid in QLExpress3 but not in QLExpress4:
1014
+
1015
+
[source,java]
1016
+
----
1017
+
// Valid in QLExpress3, but not in QLExpress4
1018
+
商家应收=
1019
+
价格
1020
+
- 饭卡商家承担
1021
+
+ 平台补贴
1022
+
----
1023
+
1024
+
In QLExpress4, the above script will be parsed as two separate statements:
1025
+
1. `商家应收 = 价格`
1026
+
2. `- 饭卡商家承担 + 平台补贴` (the second statement will result in a syntax error)
1027
+
1028
+
To achieve the same effect in QLExpress4, you need to place the operator at the end of the line rather than at the beginning:
1029
+
1030
+
[source,java]
1031
+
----
1032
+
// Correct way in QLExpress4
1033
+
商家应收=
1034
+
价格 -
1035
+
饭卡商家承担 +
1036
+
平台补贴
1037
+
----
1038
+
1039
+
This way, the interpreter knows that the current line's expression is not yet complete and will continue reading the next line.
1040
+
1041
+
If you need to be compatible with QLExpress3's newline behavior, you can set the `strictNewLines` option to `false`:
Note: Non-strict newline mode causes the interpreter to ignore all newlines, which may affect code readability and the accuracy of error messages. It is recommended to use this only when you need to be compatible with legacy code.
1049
+
1009
1050
=== Obtaining char Type
1010
1051
1011
1052
In QLExpress 3, single characters wrapped in single quotes were parsed as char type, not String.
0 commit comments