Skip to content

Commit 9723b98

Browse files
author
Dean Wampler
committed
Use vals
1 parent ff34fc5 commit 9723b98

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/script/scala/progscala3/meta/inline/ConditionalMatch.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ inline def repeat2(s: String, count: Int): String =
55
else s + repeat2(s, count-1)
66

77
repeat2("hello", 3) // Okay
8-
var n = 3
9-
repeat2("hello", n) // ERROR!
8+
val n = 3
9+
repeat2("hello", n) // ERROR! (try "inline val n = 3")
1010

1111
inline def repeat3(s: String, count: Int): String =
1212
inline count match

src/script/scala/progscala3/meta/inline/Recursive.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ inline def repeat(s: String, count: Int): String =
55
else s + repeat(s, count-1)
66

77
repeat("hello", 3) // Okay
8-
var n=3
9-
repeat("hello", n) // ERROR!
8+
val n=3
9+
repeat("hello", n) // ERROR! (try "inline val n = 3")

0 commit comments

Comments
 (0)