Let’s Learn How To Code Using Kotlin — Part 003
Cody Engel

Cody, greetings my friend. I just have a couple of questions. However, I’m not exactly sure if I’m using the right terms. Here are my questions:

  1. Though Kotlin allows us to get away with NOT having to declare the ‘var’ or ‘val’ type (whether it is an “Int” or a “String”. etc.), is it better to declare it anyway? Does it make a difference in the speed, or reliability of the application at compile-time, or at runtime? Would declaring the ‘var’ or ‘val’ type (explicitly typing “Int” or “String”) make the application more robust, and reliable?
  2. Since the “While” function seems very flexible, and able to execute logic the same way the “If” function does, it is possible to just use “While”, and bypass the “If” function completely? It seems that using the “While” function requires fewer lines of code.

Looking forward to your clarifications, and advice.

Thank you!!

Like what you read? Give Michael DeGuzman a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.