forked from point-software-ag/scala-hack-session
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFirstSteps01Expressions.sc
68 lines (60 loc) · 3.68 KB
/
FirstSteps01Expressions.sc
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
package day01session01.first_steps
/*
* This file is part of the "Scala Hack Session".
*
* Scala Hack Session is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Scala Hack Session is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Scala Hack Session. If not, see <http://www.gnu.org/licenses/>.
*
* =================================================================================
*
*/
object FirstSteps01Expressions {
//This println function respectively method prints out the given parameter.
//The output is on the right starting with "> ...."
//Also note that a ";" at the end of the line is not required. Details: http://java.dzone.com/articles/scala-wonderland-semicolons
println("Welcome Hacker! You have entered Level 1 of Scala Hack Session")
//> Welcome Hacker! You have entered Level 1 of Scala Hack Session
//try and print "Hello, World"
//now print a number like 1. Note: do not use "1", just 1
//Enter your code in the next line
//NOTE: don't be confused about the "???". As a result a NotImplementedError is shown.
//Below there are more ??? without an error. The reason is the that worksheets are processed top-down.
//once you have replaced the first "???" the IDE parses the output and then the next ??? shows an error.
??? //> scala.NotImplementedError: an implementation is missing
//| at scala.Predef$.$qmark$qmark$qmark(Predef.scala:252)
//| at day01session01.first_steps.FirstSteps01Expressions$$anonfun$main$1.ap
//| ply$mcV$sp(day01session01.first_steps.FirstSteps01Expressions.scala:37)
//| at org.scalaide.worksheet.runtime.library.WorksheetSupport$$anonfun$$exe
//| cute$1.apply$mcV$sp(WorksheetSupport.scala:76)
//| at org.scalaide.worksheet.runtime.library.WorksheetSupport$.redirected(W
//| orksheetSupport.scala:65)
//| at org.scalaide.worksheet.runtime.library.WorksheetSupport$.$execute(Wor
//| ksheetSupport.scala:75)
//| at day01session01.first_steps.FirstSteps01Expressions$.main(day01session
//| 01.first_steps.FirstSteps01Expressions.scala:22)
//| at day01session01.first_steps.FirstSteps01Expressions.main(day01session0
//| 1.first_steps.FirstSteps01Expressions.scala)
//====================== Arithmetic Expressions
//Try adding two values like 40 and 2
???
//next, add 1.5 to 2.5:
???
//try with more operands like: 5 times 8 plus 2
???
//what if you put the plus in front? 2 plus 5 times 8?
???
//what about using brackets? (2 + 5) * 8
???
//what is the result of 15 modulo 4 multiplied with 2?
???
}