We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9df0f82 commit fba039fCopy full SHA for fba039f
doc/Language/create-cli.rakudoc
@@ -325,20 +325,21 @@ automatically to its corresponding C<enum> symbol:
325
326
=begin code
327
enum Flag (
328
- FLAG_FOO => 0b001,
329
- FLAG_BAR => 0b010,
330
- FLAG_BAZ => 0b100,
+ FLAG_FOO => 40,
+ FLAG_BAR => 41
+ FLAG_BAZ => 42,
331
);
332
333
sub MAIN(Flag $flag = FLAG_FOO) {
334
- say "Flagging $flag";
+ say "Flagging $flag with value $flag.value()";
335
}
336
=end code
337
338
This will work correctly with
339
340
=for code :lang<text>
341
-raku MAIN-enum.raku FLAG_BAR
+raku MAIN-enum.raku FLAG_BAZ
342
+# OUTPUT: «Flagging FLAG_BAZ with value 42»
343
344
but will die if called with something that is not a C<Flag>.
345
0 commit comments