RosettaCodeData/Task/Loops-Nested/Tailspin/loops-nested.tailspin

16 lines
365 B
Plaintext

sink find20
def a: $;
1 -> #
when <..$a::length> do def i: $;
'$#10;' -> !OUT::write
1 -> \(
when <$a($i)::length~..> do $i + 1 !
otherwise def j: $;
def val: $a($i;$j);
' $val;' -> !OUT::write
$val -> \(<~=20> $j + 1 ! \) -> #
\) -> #
end find20
[1..10 -> [1..10 -> 20 -> SYS::randomInt -> $ + 1]] -> !find20