Created
August 7, 2020 06:47
-
-
Save husen-hn/73af94e31a395331953f4be95000e7af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val mutable = MyValue.Mutable("Foo") | |
val immutable = MyValue.Immutable("Foo") | |
mutable.value = "Bar" // This is fine | |
immutable.value = "Bar" // This will not compile because value cannot be reassigned | |
val mutated = immutable.mutate() | |
mutated.value = "Bar" // This is fine | |
immutable.value = "Bar" // This will not compile because value cannot be reassigned | |
val immutated = mutated.immutate() | |
immutated.value = "Bar" // This will not compile because value cannot be reassigned |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment