Learning Kotlin: How to Write a Single Expression Function in Kotlin

In this video, you’ll learn how to write a Single Expression Function in kotlin

📚 Reference Documentation: https://kotlinlang.org/docs/reference/functions.html#single-expression-functions

Thoughts or questions about single expression functions? Comment below or share on social media. I’d love to continue the conversation.


I love to meet/talk/discuss and help where I can. If you want to chat or ask a question you can follow me on Twitter, YouTube, Instagram and Facebook.

Check Out My YouTube Channel

Learning Kotlin: Learn to Write a Basic Kotlin Function

Another Learning Kotlin tutorial for beginners. Helping you learn Kotlin 1 small tutorial at a time.

In this video, you’ll learn Kotlin function basics. We’ll walk through how to write a basic Kotlin function and look at the ‘fun’ keyword, function names, and defining your function body.

 📚Reference: https://kotlinlang.org/docs/reference/functions.html


I love to meet/talk/discuss and help where I can. If you want to chat or ask a question you can follow me on Twitter, YouTube, Instagram and Facebook.

Check Out My YouTube Channel

Learning Kotlin: ‘lateinit’ Modifier

This Kotlin tutorial explores the lateinit modifier and gives several examples of how you can use lateinit in Android or other Kotlin projects.

lateinit allows you to defer initialization of non-null values so they can still be defined as non-null, but can be assigned later as in many dependency injection or test frameworks.

ex:

  • lateinit var userId:String

This is a non-null type, without a non-null initializer. Without lateinit, this would not be valid Kotlin code.

  • 0:17 What is lateinit used for?
  • 0:40 Why is lateinit useful?
  • 1:23 How to use lateinit?
  • 1:30 Android dependency injection example
  • 3:00 Testing example
  • 4:05 Where can lateinit be used?

Reference Documentation: https://kotlinlang.org/docs/reference…

Thoughts or questions about the lateinit modifier in Kotlin? Comment below or share on social media. I’d love to continue the conversation.


I love to meet/talk/discuss and help where I can. If you want to chat or ask a question you can follow me on Twitter, YouTube, Instagram and Facebook.

Check Out My YouTube Channel

Learning Kotlin: Type Aliases

Type aliases in Kotlin allow you to provide alternative names for existing types. This is particularly useful for shortening long type names, or for providing more semantic meaning to existing types.

For example, instead of using ‘String’ you could create a type alias called ‘UserId’ that provides more information about the expected usage of that type.

💻 Examples:

'typealias UserId = String'

You can then substitute ‘UserId’ where you would otherwise use ‘String’. To the compiler, they both are treated the same.

📚 Reference:

Thoughts, questions, tips on type aliases in Kotlin? Comment below or share on social media. I’d love to continue the conversation.


I love to meet/talk/discuss and help where I can. If you want to chat or ask a question you can follow me on Twitter, YouTube, Instagram and Facebook.

Check Out My YouTube Channel

Learning Kotlin: ‘Const’ Modifier

Kotlin’s ‘const’ modifier allows you to mark a variable as a true, JVM compile-time constant.

To do this, the variable must meet several requirements.

  • 1. Must be a top-level variable or a variable on an Object
  • 2. Must be a String or primitive type
  • 3. No custom getter
  • 0:30 Example case study
  • 1:18 Examine bytecode
  • 1:26 Understand what happens without ‘const’
  • 1:44 Add ‘const’ keyword
  • 2:05 Create top-level, const val

Thoughts, questions, tips on using ‘const’ in Kotlin? Comment below or share on social media. I’d love to continue the conversation.


I love to meet/talk/discuss and help where I can. If you want to chat or ask a question you can follow me on Twitter, YouTube, Instagram and Facebook.

Check Out My YouTube Channel