parameter

Used to declare a parameter with the supplied arguments.

val letter by parameter('a'..'z')

See also


@JvmName(name = "parameterLazySequence")
inline fun <T> ParameterizeScope.parameter(crossinline lazyArguments: LazyParameterScope.() -> Sequence<T>): ParameterizeScope.Parameter<T>(source)
@JvmName(name = "parameterLazyIterable")
inline fun <T> ParameterizeScope.parameter(crossinline lazyArguments: LazyParameterScope.() -> Iterable<T>): ParameterizeScope.Parameter<T>(source)

Used to declare a parameter with the computed lazyArguments. The arguments are only computed the first time the parameter is used, and not at all if used.

This parameter function is useful to avoid computing the arguments every iteration. Instead, these arguments will only be computed the first time the parameter is used.

val evenNumberSquared by parameter {
numbers
.filter { it % 2 == 0 }
.map { it * it }
}

See also