Why Kotlin’s Elvis Operator is Better Than Swift’s Guard Statement

It’s similar but better

Picture by Mediamodifier on Pixabay

If you’ve programmed for iOS Swift before, you’ll find this interesting keyword, guard, that helps to guard and ensure some condition is met or some variable is not null before proceeding.

func process(couldBeNullMesage: String?) {
guard let notNullMessage = couldBeNullMesage else {…




Sharing iOS, Android and relevant Mobile App Development Technology and Learning

Recommended from Medium

Introduction to GraphQL

Support multiple types in codable — swift

From Cheesemonger to Developer Student

Terraform with AWS…

Create your own Prometheus and node_exporter in Openshift4.3 (2/2)

Difference between “Show” and “As” in Import Statement

Math in Unity - Calculate the way to the closest enemy

Focus on The Web3 Era, The Launch of Dtools Ushered in A Tool Revolution.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Sharing Software Development Experience, focus on Mobile. https://elye-project.medium.com/subscribe https://twitter.com/elye_project

More from Medium

Android Dev Must-Know Data Format: Protocol Buffers

Dagger/Hilt vs Koin for Jetpack Compose Apps

Getting… rid of those missing android* source sets warnings on your KMP project

How To Test Kotlin Coroutines?

People creating