Programming in Kotlin - Part 8: Challenge: Booleans | Ray Wenderlich

Practice using Booleans on your own, through a hands-on challenge.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4736-programming-in-kotlin/lessons/8

Possible errata in the example:

The first portion of the challenge states to “Create a constant called ‘myAge’”. Then in the later portion it asks " Use the constant called myAge and initialize it with your age". It is my understanding that you cannot re-assign a constant later in the code and the constant is already initialized.

Possible solution:

  1. create another variable
  2. change myAge from constant to a variable using the ‘var’ keyword instead of ‘val’

I just reviewed the code and realize the confusion. The comments are a bit misleading in that it says to initialize the constant 2x even though it should be initialized 1x at the beginning.
I’ll clean up the comments to reflect that.
Thanks!