Lesson 2: Kotlin Functions and Classes
Outline:
- Questions?
- Recap Kotlin basics
valversusvarwhenstatementsforranges- examples: Exercise 1
- Functions in Kotlin
- passing parameters
- default values
- returning a value
- examples: Exercise 2
- Classes in Kotlin
- constructors and
initblock - instance variables
- methods
- example: Exercise 3
- constructors and
- Wrap-up
What’s next
Upcoming events/assessments:
- CS Bits and Bytes tomorrow at 3:30pm in Anderson 329: Meet the CS Department!
- Quiz 1 will be next Monday and cover the first several Quiz Learning Objectives
- Assignment 1 is due Friday!
What you should do now:
- The readings (see below)
- Read the syllabus!
- Complete Part A of Assignment 1 today, and bring questions about Parts B and C to student hours or class Friday
Reading assignment (to be completed by the next class):
Kotlin basics, cont’d (from today):
Kotlin basics, cont’d and Big-O (for next time):