Files
wren/test/language/method/newlines.wren
Bob Nystrom 78655c68b0 Simple string interpolation.
This allows "%(...)" inside a string literal to interpolate the
stringified result of an expression.

It doesn't support custom interpolators or format strings, but we can
consider extending that later.
2015-11-11 07:55:48 -08:00

22 lines
357 B
Plaintext

class Foo {
construct new() {}
method(a, b) { "method %(a) %(b)" }
[a, b] { "subscript %(a) %(b)" }
}
var foo = Foo.new()
// Allow newlines after commas and before ")".
System.print(foo.method("a",
"b"
)) // expect: method a b
// Allow newlines after commas and before "]".
System.print(foo["a",
"b"
]) // expect: subscript a b