Skip to content

Commit bbfa1ce

Browse files
author
changye
committed
scala note
2 parents 045b751 + beae17f commit bbfa1ce

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

scala.note.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ In Scala, `public` is the default access level.
139139

140140
Method parameters in Scala are vals, not vars.
141141

142+
<<<<<<< HEAD
142143
The Scala compiler treats a function defined in the procedure style, with curly braces but no equals sign, essentially the same as a function that explicitly declares its result type to be Unit:
143144

144145
def g() { "this string gets lost" }
@@ -152,3 +153,11 @@ If you intend to return a non-Unit value without explicitly declare result type,
152153
The function `h` returns String.
153154

154155
-----
156+
=======
157+
---
158+
Prefer vals, immutable objects, and methods without side effects. Reach for them first. Use vars, mutable objects, and moethods with side effects when you have a specific need and justification for them.
159+
160+
---
161+
162+
163+
>>>>>>> beae17fb4f757ea2c0b226a65276a256947b81ca

0 commit comments

Comments
 (0)