Skip to content

Commit 02df798

Browse files
committed
Add a command execution result
1 parent 0bf2746 commit 02df798

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

_tour/basics.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,17 @@ println("Hello, " + name + "!")
169169
There are some other differences, but for now, you can think of them as something similar to functions.
170170

171171
Methods can have multi-line expressions as well.
172+
173+
{% scalafiddle %}
172174
```tut
173175
def getSquareString(input: Double): String = {
174176
val square = input * input
175177
square.toString
176178
}
179+
println(getSquareString(2.5)) // 6.25
177180
```
181+
{% endscalafiddle %}
182+
178183
The last expression in the body is the method's return value. (Scala does have a `return` keyword, but it's rarely used.)
179184

180185
## Classes

0 commit comments

Comments
 (0)