File tree Expand file tree Collapse file tree 1 file changed +26
-13
lines changed
Lexical Scopes/Lexical Scoping Expand file tree Collapse file tree 1 file changed +26
-13
lines changed Original file line number Diff line number Diff line change @@ -41,29 +41,37 @@ separated by semicolons:
4141
4242One issue with Scala's semicolon convention is how to write expressions that span
4343several lines. For instance:
44-
44+ ```
4545 someLongExpression
46+ ```
47+ ```
4648 + someOtherExpression
47-
49+ ```
4850would be interpreted as * two* expressions:
49-
51+ ```
5052 someLongExpression;
53+ ```
54+ ```
5155 + someOtherExpression
52-
56+ ```
5357There are two ways to overcome this problem.
5458
5559You could write the multi-line expression in parentheses, because semicolons
5660are never inserted inside ` (…) ` :
57-
61+ ```
5862 (someLongExpression
63+ ```
64+ ```
5965 + someOtherExpression)
60-
66+ ```
6167Or you could write the operator on the first line, because this tells the Scala
6268compiler that the expression is not yet finished:
63-
69+ ```
6470 someLongExpression +
71+ ```
72+ ```
6573 someOtherExpression
66-
74+ ```
6775## Top-Level Definitions
6876
6977In real Scala programs, ` def ` and ` val ` definitions must be written
@@ -138,16 +146,21 @@ These are:
138146Here are the fully qualified names of some types and functions
139147which you have seen so far:
140148
141-
149+ ```
142150 Int scala.Int
151+ ```
152+ ```
143153 Boolean scala.Boolean
154+ ```
155+ ```
144156 Object java.lang.Object
157+ ```
158+ ```
145159 String java.lang.String
146-
160+ ```
147161## Writing Executable Programs
148-
149- So far our examples of code were executed from your Web
150- browser, but it is also possible to create standalone
162+
163+ Let's consider creating standalone
151164applications in Scala.
152165
153166Each such application contains an object with a ` main ` method.
You can’t perform that action at this time.
0 commit comments