summaryrefslogtreecommitdiff
path: root/support/context/Template/Scala.ctpl
blob: ed5486f70f0a1ade3e1b31fc355277d228d88d91 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
[class | Scala class template]
class |MyClass {

}

[def | function definition]
def |myFunc(): = {
}

[exit | System.exit]
System.exit(|);

[for | for comprehensions]
for (val i <- |) {}

[if | if expression]
if (|) {
  
}

[ife | if-else expression]
if (|) {
  
}
else {
  
}

[main | Scala program template]
object |Main {

    /** Code documentation here */
  def main(args: Array[String]): Unit = {
    /* multi-line and semi-line comments here */
    // one-line comments here
    Console.println("Hello, world");
  }

}

[match | match expression]
| match {
  case   => 
  case _ => 
}

[Pair | Pair object]
Pair(|, )

[println | Console.println]
Console.println(|);

[trait | Scala trait template]
trait |MyTrait {
}

[try | try-catch block]
try {
  |
}
catch {
  case e: Exception =>
    Console.println("Unexpected exception");
    e.printStackTrace();
}

[val | value definition]
val | = ;

[while | while block]
var i=0;
while (i < |) {
  
  i = i + 1;
}