Topic variable: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
m (omit from|ARM Assembly)
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 250:
[1,4,9,16,25,36,49,64,81,100]
</lang>
 
=={{header|J}}==
With this new definition of topic variables, the closest thing J has to a topic variable is probably dummy variables used in function definitions, because we always omit declaring which variables they are, and because we may omit them entirely. But, we still need to place the function in the context of the value it's being used on.
Line 390 ⟶ 391:
outer 2:
inner 1, inner 2, inner 3, fini</pre>
 
=={{header|Perl 6}}==
 
As in previous versions of Perl, in Perl6 the topic variable is $_. In addition to a direct affectation, it can also be set with the 'given' keyword. A method can be called from it with an implicit call:
 
<lang perl6>given 3 {
.say for $_**2, .sqrt;
}</lang>
The scope of the <tt>$_</tt> variable is always lexical in Perl 6, though a function can access its caller's topic if it asks for it specially via <tt>CALLER::<$_></tt>.
 
=={{header|Phix}}==
Line 543 ⟶ 535:
(require 'sample2)
</lang>
 
=={{header|Perl 6Raku}}==
(formerly Perl 6)
 
As in previous versions of Perl, in Perl6 the topic variable is $_. In addition to a direct affectation, it can also be set with the 'given' keyword. A method can be called from it with an implicit call:
 
<lang perl6>given 3 {
.say for $_**2, .sqrt;
}</lang>
The scope of the <tt>$_</tt> variable is always lexical in Perl 6, though a function can access its caller's topic if it asks for it specially via <tt>CALLER::<$_></tt>.
 
=={{header|REXX}}==
Line 640 ⟶ 642:
=={{header|VBA}}==
VBA does not have special or topic variables. All variables have a letter as their first character.
 
=={{header|zkl}}==
No topic variable pre se (a variable name can be a single character however), but underscore has a special meaning in some cases. Its use is scoped to the expression it is used in.
10,333

edits