Skip to content

Commit fba039f

Browse files
authored
make flag example clearer
1 parent 9df0f82 commit fba039f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/Language/create-cli.rakudoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,20 +325,21 @@ automatically to its corresponding C<enum> symbol:
325325

326326
=begin code
327327
enum Flag (
328-
FLAG_FOO => 0b001,
329-
FLAG_BAR => 0b010,
330-
FLAG_BAZ => 0b100,
328+
FLAG_FOO => 40,
329+
FLAG_BAR => 41
330+
FLAG_BAZ => 42,
331331
);
332332

333333
sub MAIN(Flag $flag = FLAG_FOO) {
334-
say "Flagging $flag";
334+
say "Flagging $flag with value $flag.value()";
335335
}
336336
=end code
337337

338338
This will work correctly with
339339

340340
=for code :lang<text>
341-
raku MAIN-enum.raku FLAG_BAR
341+
raku MAIN-enum.raku FLAG_BAZ
342+
# OUTPUT: «Flagging FLAG_BAZ with value 42␤»
342343

343344
but will die if called with something that is not a C<Flag>.
344345

0 commit comments

Comments
 (0)