Programming in Kotlin: Fundamentals

Aug 9 2022 · Kotlin 1.6, Android 12, IntelliJ IDEA CE 2022.1.3

Part 1: Use Data Types & Operations

04. Use Booleans & Comparison Operators

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 03. Explore Kotlin Language Basics Next episode: 05. Challenge: Booleans

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

So far in this course, you’ve learned about a few data types:

val isProgrammingAwesome = true
val isLazinessAwesome = false
println("Is programming awesome? $isProgrammingAwesome")
println("Is laziness awesome? $isLazinessAwesome")

Demo 2

To see this in action, you’ll set up a simple scenario with some students with different grades, and you’ll set up some Boolean variables depending on who passed — and who failed.

val passingGrade = 50
val studentGrade = 74
val studentPassed = studentGrade > passingGrade
println(studentPassed)
val studentFailed = studentGrade < passingGrade
println(studentFailed)
// val studentGrade = 74
val studentGrade = 50
// val studentPassed = studentGrade > passingGrade
val studentPassed = studentGrade >= passingGrade
val chrisGrade = 49
val samGrade = 99
=
print(samGrade == chrisGrade)
print(samGrade != chrisGrade)
val catName = "Ozma"
val dogName = "Cosmos"
print(catName == dogName)