site/docs improvements

This commit is contained in:
sergeych committed 2025-11-28 11:25:47 +01:00
1 parent 26ddb94f5d
commit e584c7aa63
8 files changed
+33 -11

No files matched your search

+2
View File
@@ -1,5 +1,7 @@
# The `when` statement (expression)
[//]: # (topMenu)
Lyng provides a concise multi-branch selection with `when`, heavily inspired by Kotlin. In Lyng, `when` is an expression: it evaluates to a value. If the selected branch contains no value (e.g., it ends with `void` or calls a void function like `println`), the whole `when` expression evaluates to `void`.
Currently, Lyng implements the "subject" form: `when(value) { ... }`. The subject-less form `when { condition -> ... }` is not implemented yet.