Created
November 17, 2019 20:59
-
-
Save magdamiu/ab7cd1d624049cb1a5f3e831773210a3 to your computer and use it in GitHub Desktop.
val vs var
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
// immediate assignment | |
val countOfEvenNumbers: Int = 10 | |
// `Int` type is inferred | |
var sumOfNumbers = 0 | |
// type required when no initializer is provided | |
var countOfPrimeNumbers: Int | |
// deferred assignment | |
countOfPrimeNumbers = 3 | |
countOfPrimeNumbers = 24 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment