@@ -12,6 +12,9 @@ import kotlin.IllegalArgumentException
12
12
* 1. Destructuring https://kotlinlang.org/docs/reference/multi-declarations.html
13
13
*/
14
14
15
+ /* *
16
+ * this looks familiar! intellij autocomlentes if you start typing 'main'
17
+ */
15
18
fun main () {
16
19
someVariableStuff()
17
20
functions()
@@ -69,6 +72,13 @@ fun paramsWithDefaultValues(one: String = "blah", two: Boolean = false, three: I
69
72
println (" \n fun params with default values: one: $one two:$two three: $three , fourNullable: $fourNullable " )
70
73
}
71
74
75
+ /* *
76
+ * Function params are val (immutable). Compile time errors result if you 'var' it
77
+ */
78
+ // fun paramsAreDefaultVal(inputString: String. var anotherInputString: String) { //compile error on var, 'expecting type name'
79
+ // // inputString = "blah" //val cannot be reassigned compile error
80
+ // }
81
+
72
82
/* *
73
83
* Lambdas
74
84
* Similar to the way java does them for the most part, with a bit less verbage
@@ -162,8 +172,8 @@ fun someFunWithEquals() {
162
172
println (" Showing equals" )
163
173
val personOne = Person (" blah" , " Johnny" , " Walker" )
164
174
val personTwo = Person (" blah" , " Johnny" , " Walker" )
165
- println (" using == in place of .equals structural equality: ${personOne == personTwo} " ) // == in place of .equals
166
- println (" using === in place of .equals refernentioal equality: ${personOne == = personTwo} " )
175
+ println (" using == is same as .equals testing structural equality: ${personOne == personTwo} " ) // == in place of .equals
176
+ println (" using === tests for referential equality: ${personOne == = personTwo} " )
167
177
}
168
178
169
179
// implicitly returns Unit
0 commit comments