Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.baeldung.scala.defvarval

object LazyValues extends App {
lazy val lazyValue: Int = {
println("lazy value")
1
}

println("After lazy value declaration")
println(lazyValue)
println(lazyValue)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.baeldung.scala.defvarval

object Methods extends App {
def method: Int = {
println("method")
1
}

println("After method declaration")
println(method)
println(method)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.baeldung.scala.defvarval

object Values extends App {
val value: Int = {
println("value")
1
}

println("After value declaration")
println(value)
println(value)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.baeldung.scala.defvarval

object Variables extends App {
var variable: Int = {
println("variable")
1
}

println("After variable declaration")
println(variable)
println(variable)

var secretNumber: Int = 5
secretNumber = 1
}