Case-sensitivity of identifiers: Difference between revisions
(→{{header|Perl}}: Added PureBasic) |
(Euphoria version) |
||
Line 9: | Line 9: | ||
There is just one dog named Bernie. |
There is just one dog named Bernie. |
||
=={{header|Euphoria}}== |
|||
{{works with|Euphoria 4.0.0}} |
|||
<lang Euphoria> |
|||
-- These variables are all different |
|||
sequence dog = "Benjamin" |
|||
sequence Dog = "Samba" |
|||
sequence DOG = "Bernie" |
|||
printf( 1, "The three dogs are named %s, %s and %s\n", {dog, Dog, DOG} ) |
|||
</lang> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
Revision as of 02:18, 7 February 2011
Three dogs (Are there three dogs or one dog?) is a code snipped used to illustrate the lettercase sensitivity of the programming language. For a case sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output:
The three dogs are named Benjamin, Samba and Bernie.
For a language that is lettercase insensitive, we get the following output:
There is just one dog named Bernie.
Euphoria
<lang Euphoria> -- These variables are all different sequence dog = "Benjamin" sequence Dog = "Samba" sequence DOG = "Bernie" printf( 1, "The three dogs are named %s, %s and %s\n", {dog, Dog, DOG} ) </lang>
Perl
<lang perl>
# These variables are all different $dog='Benjamin'; $Dog='Samba'; $DOG='Bernie'; print "The three dogs are named $dog, $Dog, and $DOG \n"
</lang>
PureBasic
<lang PureBasic>dog$="Benjamin" Dog$="Samba" DOG$="Bernie" Debug "There is just one dog named "+dog$</lang>