Unit 2 Pathway 1: Kotlin fundamentals¶ Kotlin fundamentals Write conditionals in Kotlin Before you begin Prerequisites What you’ll learn What you’ll need Use if/else statements to express conditions Use a when statement for multiple branches Use if/else and when as expressions Conclusion Use nullability in Kotlin Before you begin Prerequisites What you’ll learn What you’ll need Use nullable variables Handle nullable variables Use the ?. safe call operator Use the !! not-null assertion operator Use the if/else conditionals Conclusion Use classes and objects in Kotlin Before you begin Prerequisites What you’ll learn What you’ll build What you’ll need Define a class Create an instance of a class Define class methods Define class properties Define a constructor Default constructor Parameterized constructor Implement a relationship between classes Relationships between classes Override superclass methods from subclasses Reuse superclass code in subclasses with the super keyword Override superclass properties from subclasses Visibility modifiers Visibility modifier for properties Visibility modifiers for methods Visibility modifiers for constructors Visibility modifiers for classes Specify appropriate visibility modifiers Define property delegates Test the solution Try this challenge Conclusion Use function types and lambda expressions in Kotlin Introduction Prerequisites What you’ll learn What you’ll need Eye Power Store a function in a variable Use functions as a data type Use a function as a return type Pass a function to another function as an argument Nullable function types Write lambda expressions with shorthand syntax Omit parameter name Pass a lambda expression directly into a function Use trailing lambda syntax Use the repeat() function Conclusion Practice: Kotlin Fundamentals Before you begin Prerequisites What you’ll need Mobile notifications Movie ticket price Temperature converter Song catalog Internet profile Foldable phones Special auction Solution code Solution: Mobile notifications Solution: Movie ticket price Solution: Temperature converter Solution: Song catalog Solution: Internet profile Solution: Foldable phones Solution: Special auction