Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
avoid variable redecl. errors when compiling
  • Loading branch information
coke committed Apr 12, 2019
1 parent 9bc4630 commit 5a3a5f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/Language/js-nutshell.pod6
Expand Up @@ -85,17 +85,21 @@ variables. Dynamic variables are looked up using the caller's scope, rather
than the outer scope. This is what the equivalent variable declarations look
like in Perl 6:
=begin code
=for code
my $foo = 1; # Lexically scoped
our $foo = 1; # Package scoped
=for code
my constant foo = 1; # Lexically scoped; constant
=for code
constant foo = 1; # Package scoped; constant
=for code
my $*foo = 1; # Dynamic variable; lexically scoped
our $*foo = 1; # Dynamic variable; package scoped
GLOBAL::<$foo> := 1; # Globally scoped
=end code
Use C<my> where you'd use C<let>, C<our> for variables you'd define in the
outermost scope needed, and C<constant> where you'd uses C<const>.
Expand Down

0 comments on commit 5a3a5f4

Please sign in to comment.