File tree 1 file changed +59
-0
lines changed
1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ - # A Scalable language
2
+ - # Object-Oriented
3
+ - # Functional
4
+ - # Seamless Java Interop
5
+ - # Functions are Objects
6
+ - # Future-Proof
7
+ - # Fun
8
+ <h3 >--Martin Odersky</h3 >
9
+
10
+ # First Example
11
+ - Compile & Run
12
+
13
+ ``` scala
14
+ 1 .scala:
15
+
16
+ object HelloWorld {
17
+ def main (args : Array [String ]) {
18
+ println(" Hello, world!" )
19
+ }
20
+ }
21
+
22
+ scalac 1 .scala
23
+ scala HelloWorld
24
+ ```
25
+
26
+ - Execute the code in Scala Shell
27
+
28
+ ``` scala
29
+ bin/ scala
30
+ scala> println(" Hello, world!" )
31
+ Hello , world!
32
+ ```
33
+
34
+ - Run the code as Script
35
+
36
+ ``` scala
37
+ file: 2 .scala
38
+
39
+ println(" Hello, world!" )
40
+
41
+ $/ tmp> scala 2 .scala
42
+ Hello , world!
43
+
44
+ ```
45
+
46
+ - Run Scala in Shell Scripts
47
+
48
+ ``` scala
49
+ file: script.sh
50
+ #!/bin/sh
51
+ exec scala " $0" " $@"
52
+ !#
53
+ object HelloWorld {
54
+ def main (args : Array [String ]) {
55
+ println(" Hello, world! " + args.toList)
56
+ }
57
+ }
58
+ HelloWorld .main(args)
59
+ ```
You can’t perform that action at this time.
0 commit comments