Scope Functions: let() & takeX()

An introduction to let() and how to combine it with takeIf() and takeUnless() to greatly simplify calculations, level the playing field when defining symmetrical binary functions, and how it can also be easily misused.

Gabriel Shanahan
The Kotlin Primer
Published in
3 min readOct 9, 2022

--

— — — — — — — — — — — — — — —

THE CURRENT VERSION OF THIS ARTICLE IS PUBLISHED HERE.

— — — — — — — — — — — — — — —

Tags: #FUNDAMENTAL CONCEPT

This article is part of the Kotlin Primer, an opinionated guide to the Kotlin language, which is indented to help facilitate Kotlin adoption inside Java-centric organizations. It was originally written as an organizational learning resource for Etnetera a.s. and I would like to express my sincere gratitude for their support.

It is recommended to read the Introduction before moving on. Check out the Table of Contents for all articles.

The definition of let is essentially:

--

--