Content deleted Content added
→CharAt: Add Perl 5 snippet and showcase only the requested example for Perl 6 |
|||
Line 175:
MyChar: Char;
begin
MyChar := MyStr[2]; // 'e'
</syntaxhighlight>
<pre>
# Example in ALGOL 68 #
"Hello, World"[2]; // 'e'
</pre>
<syntaxhighlight lang="csharp">
// Example in C# and Ya
"Hello, World"[2]; // 'l'
</syntaxhighlight>
<syntaxhighlight lang="perl">
# Example in Perl 5
</syntaxhighlight>
<syntaxhighlight lang="perl6">
#
"Hello, World".substr(
▲"Hello World".substr(*-1, *) # 'd'
</syntaxhighlight>
<syntaxhighlight lang="python">
# Examples in Python
"Hello, World"[2] # 'l'
"Hello, World"[-3] # 'r'
</syntaxhighlight>
Line 212 ⟶ 216:
<syntaxhighlight lang="smalltalk">
" Example in Smalltalk "
'Hello, World' at: 2. "$e"
</syntaxhighlight>
<!-- endsection -->
|