blob: 8c30fa648729c6c11b199756dc8df9d8e155261b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Test code blocks.
---
All none
// Nothing evaluates to none.
{}
// Let evaluates to none.
{ let v = 0 }
// Type is joined with trailing none, evaluates to string.
{
type("")
none
}
---
// Evaluates to single expression.
{ "Hello" }
// Evaluates to string.
{ let x = "Hel"; x + "lo" }
// Evaluates to join of none, [He] and the two loop bodies.
{
let parts = ("l", "lo")
[He]
for s in parts [{s}]
}
---
// Evaluates to join of the templates and strings.
{
[Hey, ]
if true {
"there!"
}
[ ]
if false [Nope]
[How are ] + "you?"
}
{
[A]
// Error: 5-6 cannot join template with integer
1
[B]
}
---
// Works the same way in code environment.
// Ref: false
#test(3, {
let x = 1
let y = 2
x + y
})
|