beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Practice with Variable Declaration and Initialization 0

Geoffrey Challen // 2022.6.0

Write a snippet of code—not a function—that:

  • declares a variable lucky of type Char and initializes it to 8
  • declares a variable named eachDay of type Double and initializes it to 1.0
  • declares a variable age of type Int and initializes it to 88
  • declares a variable named learnCSOnline of type Boolean and initializes it to true

Note that because Kotlin performs type inference, you can and should solve this problem without explicitly specifying any types.