Unicode variable names: Difference between revisions

From Rosetta Code
Content added Content deleted
(Match task description!)
(Protium. Incomplete. Documentation site down for now)
Line 5: Line 5:
:* Increment it
:* Increment it
:* Then print its value.
:* Then print its value.

=={{header|Protium}}==
1. (working on it)
2.
<lang protium><@ LETVARLIT>Δ|1</@>
<@ ACTICRVAR>Δ</@>
<@ SAYVAR>Δ</@></lang>

Using what Google Translate says is the Traditional Chinese for 'delta'
<lang protium><@ LETVARLIT>三角洲|1</@>
<@ ACTICRVAR>三角洲</@>
<@ SAYVAR>三角洲</@></lang>


=={{header|Python}}==
=={{header|Python}}==

Revision as of 09:29, 1 July 2011

Unicode variable names is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
  1. Describe, and give a pointer to documentation on your languages use of characters beyond those of the ASCII character set in the naming of variables.
  2. Show how to:
  • Set a variable with a name including the 'Δ', (delta character), to 1
  • Increment it
  • Then print its value.

Protium

1. (working on it)

2. <lang protium><@ LETVARLIT>Δ|1</@> <@ ACTICRVAR>Δ</@> <@ SAYVAR>Δ</@></lang>

Using what Google Translate says is the Traditional Chinese for 'delta' <lang protium><@ LETVARLIT>三角洲|1</@> <@ ACTICRVAR>三角洲</@> <@ SAYVAR>三角洲</@></lang>

Python

Within the ASCII range (U+0001..U+007F), the valid characters for identifiers are the same as in Python 2.x: the uppercase and lowercase letters A through Z, the underscore _ and, except for the first character, the digits 0 through 9.

Python 3.0 introduces additional characters from outside the ASCII range (see PEP 3131). For these characters, the classification uses the version of the Unicode Character Database as included in the unicodedata module.

Identifiers are unlimited in length. Case is significant.

<lang python>>>> Δx = 1 >>> Δx += 1 >>> print(Δx) 2 >>> </lang>