Syntax

Kotlin Scope Function let Syntax

In Kotlin, scope function let: runs code on a non-null value — name?.let { println(it) }

Quick Answer

Syntax
name?.let { println(it) }
KotlinSyntax

Scope Function let

Code example
name?.let { println(it) }

Runs code on a non-null value.

Learn More

How to scope function let in Kotlin

  1. Open your Kotlin file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Kotlin Scope Function let Syntax

Use name?.let { println(it) }.

Related Syntax References

Frequently asked questions

What is the Kotlin syntax for scope function let?

Use this pattern: name?.let { println(it) }

Can I copy this Kotlin code example?

Yes. Use Copy code and adapt the example to your program.

Is this Kotlin syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify