blob: 8358c196c8db5ea2488abd966f21306688a50c1f [file] [log] [blame]
Roman Elizarov5b5dc172017-03-13 15:02:30 +03001/*
Roman Elizarov1f74a2d2018-06-29 19:19:45 +03002 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
Roman Elizarov5b5dc172017-03-13 15:02:30 +03003 */
4
5package kotlinx.coroutines.experimental.selects
6
7/**
8 * Loops while [select] expression returns `true`.
9 *
10 * The statement of the form:
11 *
12 * ```
13 * whileSelect {
14 * /*body*/
15 * }
16 * ```
17 *
18 * is a shortcut for:
19 *
20 * ```
21 * while(select<Boolean> {
22 * /*body*/
23 * }) {}
24 */
25suspend fun whileSelect(builder: SelectBuilder<Boolean>.() -> Unit) {
26 while(select<Boolean>(builder)) {}
27}