For

Run Settings
LanguageRaku
Language Version
Run Command
my @a = < alpha beta gamma delta >; for @a { say $_; } say ''; .say for @a; say ''; for @a -> $x { say $x; } say ''; for @a -> $x, $y { say "$x $y"; } say ''; my %h = alpha => 'a', beta => 'b', gamma => 'c', delta => 'd'; for %h.kv -> $greek, $latin { say "$greek=$latin"; } say ''; for 1..5 -> Int $i { say $i; } say ''; my @itemlist = ( { book => {author => 'Пушкин А. С.', title => 'Сказка о попе и ...'}, count => 1, tags => qw|Поп Балда попадья черти| }, { book => {author => 'Гоголь Н. В.', title => 'Ночь перед ...'}, count => 1, tags => qw|Вакула Солоха Дьяк Чёрт| }, ); for @itemlist -> % (:%book (Str:D :$title, Str:D :$author), Int :$count, :@tags ($first-tag, *@other-tags)) { say "$title, $author, $count, $first-tag, @other-tags[]"; } # see: https://docs.perl6.org/language/phasers#Loop_Phasers say ''; my @a2 = 1..Inf; my $s = '-' x 10; for @a2[^5] -> Int $i { FIRST { say "Поехали!\n{$s}"; } say $i; NEXT { say $s; } LAST { say 'Полёт завершён!'; } } say ''; my @q = 1,3...Inf; for @q { say $_; # You can... next if $_ == 3; # Skip to the next iteration (`continue` in C-like languages). redo if $_ == 4; # Re-do the iteration, keeping the same topic variable (`$_`). last if $_ > 5; # Or break out of a loop (like `break` in C-like languages). } say ''; my @foo = 1..3; for @foo <-> $_ { $_++ } say @foo; # [2, 3, 4] say ''; my @list = 1, 2, 3, 4; for @list -> $a, $b = 'N/A', $c = 'N/A' { say "$a $b $c" } # 1 2 3 # 4 N/A N/A
Editor Settings
Theme
Key bindings
Full width
Lines