We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0bf2746 commit 02df798Copy full SHA for 02df798
_tour/basics.md
@@ -169,12 +169,17 @@ println("Hello, " + name + "!")
169
There are some other differences, but for now, you can think of them as something similar to functions.
170
171
Methods can have multi-line expressions as well.
172
+
173
+{% scalafiddle %}
174
```tut
175
def getSquareString(input: Double): String = {
176
val square = input * input
177
square.toString
178
}
179
+println(getSquareString(2.5)) // 6.25
180
```
181
+{% endscalafiddle %}
182
183
The last expression in the body is the method's return value. (Scala does have a `return` keyword, but it's rarely used.)
184
185
## Classes
0 commit comments