Skip to content

Commit 752b9a6

Browse files
committed
Lexical Scopes - Lexical Scoping: task.md fixed formatting
1 parent af447ea commit 752b9a6

File tree

1 file changed

+26
-13
lines changed
  • Lexical Scopes/Lexical Scoping

1 file changed

+26
-13
lines changed

Lexical Scopes/Lexical Scoping/task.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,37 @@ separated by semicolons:
4141

4242
One issue with Scala's semicolon convention is how to write expressions that span
4343
several lines. For instance:
44-
44+
```
4545
someLongExpression
46+
```
47+
```
4648
+ someOtherExpression
47-
49+
```
4850
would be interpreted as *two* expressions:
49-
51+
```
5052
someLongExpression;
53+
```
54+
```
5155
+ someOtherExpression
52-
56+
```
5357
There are two ways to overcome this problem.
5458

5559
You could write the multi-line expression in parentheses, because semicolons
5660
are never inserted inside `(…)`:
57-
61+
```
5862
(someLongExpression
63+
```
64+
```
5965
+ someOtherExpression)
60-
66+
```
6167
Or you could write the operator on the first line, because this tells the Scala
6268
compiler that the expression is not yet finished:
63-
69+
```
6470
someLongExpression +
71+
```
72+
```
6573
someOtherExpression
66-
74+
```
6775
## Top-Level Definitions
6876

6977
In real Scala programs, `def` and `val` definitions must be written
@@ -138,16 +146,21 @@ These are:
138146
Here are the fully qualified names of some types and functions
139147
which 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
151164
applications in Scala.
152165

153166
Each such application contains an object with a `main` method.

0 commit comments

Comments
 (0)