Jump to content

Unicode variable names: Difference between revisions

Added implementation in C#.
(Added DWScript)
(Added implementation in C#.)
Line 21:
=={{header|C}}==
C has limited support for Unicode in variable names, see Annex D of the [http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf C standard].
 
=={{header|C sharp}}==
Section 2.4.2 of the [http://go.microsoft.com/fwlink/?LinkId=199552 C# Language Specification] gives rules for identifiers. They correspond exactly to those recommended by the [http://unicode.org/reports/tr31/ Unicode Standard Annex 31], except that underscore is allowed as an initial character (as is traditional in the C programming language), Unicode escape sequences are permitted in identifiers, and the "@" character is allowed as a prefix to enable keywords to be used as identifiers.
<lang csharp>class Program
{
static void Main()
{
var Δ = 1;
Δ++;
System.Console.WriteLine(Δ);
}
}</lang>
Output:
<pre>2</pre>
 
=={{header|D}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.