Case-sensitivity of identifiers: Difference between revisions
m
syntax highlighting fixup automation
Thundergnat (talk | contribs) m (→{{header|C sharp}}: Regularize header markup to recommended on category page) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 17:
=={{header|11l}}==
11l identifiers are case sensitive.
<
V Dog = ‘Samba’
V DOG = ‘Bernie’
print(‘The three dogs are named ’dog‘, ’Dog‘ and ’DOG‘.’)</
=={{header|Action!}}==
<
CHAR ARRAY dog="Bernie"
PrintF("There is just one dog named %S.",dog)
RETURN</
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Case-sensitivity_of_identifiers.png Screenshot from Atari 8-bit computer]
Line 36:
=={{header|Ada}}==
case insensitive
<
procedure Dogs is
Dog : String := "Bernie";
begin
Ada.Text_IO.Put_Line ("There is just one dog named " & DOG);
end Dogs;</
Output:
Line 48:
=={{header|Agena}}==
Translation of Algol W. Agena is case sensitive, as this example demonstrates. Tested with Agena 2.9.5 Win32
<
local dog := "Benjamin";
scope
Line 60:
epocs
epocs
epocs</
{{out}}
<pre>
Line 67:
=={{header|Aime}}==
<
dog = "Benjamin";
Line 73:
DOG = "Bernie";
o_form("The three dogs are named ~, ~ and ~.\n", dog, Dog, DOG);</
=={{header|ALGOL 68}}==
Line 80:
{{wont work with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release [http://sourceforge.net/projects/algol68/files/algol68toc/algol68toc-1.8.8d/algol68toc-1.8-8d.fc9.i386.rpm/download 1.8-8d] - due to extensive use of '''format'''[ted] ''transput''.}}
A joke code entry... :-) ¢ but the code does actually work!
'''File: Case-sensitivity_of_identifiers.a68'''<
# -*- coding: utf-8 -*- #
Line 91:
printf(($"The three dogs are named "g", "g" and "g"."l$, dog, Dog, DOGgy));
0
)</
<pre>
The three dogs are named Benjamin, Samba and Bernie.
Line 103:
<br>
However, depending on the "stropping" convention used and the implementation, Algol 68 can be case-sensitive. Rutgers ALGOL 68 uses quote stropping and allows both upper and lower case in identifiers and bold words. The standard bold words must be in lower-case.
<
'string' dog = "Benjamin";
'begin'
Line 115:
'end'
'end'
'end'</
{{out}}
Line 124:
=={{header|ALGOL W}}==
Algol W identifiers are not case-sensitive but variable names in inner blocks can be the same as those in outer blocks...
<
string(8) dog;
dog := "Benjamin";
Line 139:
end
end
end.</
{{out}}
<pre>
Line 146:
=={{header|APL}}==
<
Dog←'Samba'
dog←'Bernie'
'The three dogs are named ',DOG,', ',Dog,', and ',dog
The three dogs are named Benjamin, Samba, and Bernie</
=={{header|Arturo}}==
<
Dog: "Samba"
DOG: "Bernie"
Line 160:
dogs: @[dog Dog DOG]
print ["The" size dogs "dog(s) are named" join.with:", " dogs]</
{{out}}
Line 167:
=={{header|AutoHotkey}}==
<
Dog := "Samba"
DOG := "Bernie"
MsgBox There is just one dog named %dOG%</
=={{header|AWK}}==
<
dog = "Benjamin"
Dog = "Samba"
DOG = "Bernie"
printf "The three dogs are named %s, %s and %s.\n", dog, Dog, DOG
}</
The three dogs are named Benjamin, Samba and Bernie.
Line 186:
{{works with|QBasic}}
QBASIC is case-insensitive
<
DOG$ = "Samba"
DOG$ = "Bernie"
PRINT "There is just one dog, named "; DOG$</
=={{header|BASIC256}}==
BASIC256 is case-insensitive
<
Dog = "Samba"
DOG = "Bernie"
print "There is just one dog, named "; dog
end</
=={{header|Batch File}}==
<
@echo off
Line 209:
echo There is just one dog named %dog%.
pause>nul
</syntaxhighlight>
{{out}}
<pre>
Line 216:
=={{header|BBC BASIC}}==
<
Dog$ = "Samba"
DOG$ = "Bernie"
PRINT "The three dogs are " dog$ ", " Dog$ " and " DOG$ "."</
Output:
<pre>The three dogs are Benjamin, Samba and Bernie.</pre>
Line 226:
The only variables are 'a' through 'z'. They can only hold numbers, not strings. Some implementations allow longer names like 'dog', but only with lowercase letters. A name like 'Dog' or 'DOG' is a syntax error.
<
ibase = 16
Line 235:
d = BE27A312
"There is just one dog named "; d
quit</
There is just one dog named BE27A312
=={{header|Bracmat}}==
<
& Samba:?Dog
& Bernie:?DOG
& out$("There are three dogs:" !dog !Dog and !DOG)
);</
Output:
<pre>There are three dogs: Benjamin Samba and Bernie</pre>
Line 252:
The three dogs are drawn as spheres in this simple example:
<
opendb dogs.g y # Create a database to hold our dogs
units ft # The dogs are measured in feet
Line 258:
in Dog.s sph 4 0 0 3 # Samba is a Labrador
in DOG.s sph 13 0 0 5 # Bernie is massive. He is a New Foundland
echo The three dogs are named Benjamin, Samba and Bernie</
=={{header|C}}==
C is case sensitive; if it would be case insensitive, an error about redefinition of a variable would be raised.
<
static const char *dog = "Benjamin";
Line 273:
printf("The three dogs are named %s, %s and %s.\n", dog, Dog, DOG);
return 0;
}</
=={{header|C sharp|C#}}==
C# is case sensitive
<
using System;
Line 289:
Console.WriteLine(string.Format("The three dogs are named {0}, {1}, and {2}.", dog, Dog, DOG));
}
}</
=={{header|C++}}==
C++ is case-sensitive.
<
#include <string>
using namespace std;
Line 301:
cout << "The three dogs are named " << dog << ", " << Dog << ", and " << DOG << endl;
}</
{{out}}
<pre>The three dogs are named Benjamin, Samba, and Bernie</pre>
Line 310:
=={{header|COBOL}}==
<
*>* Commented-out lines in the working storage
*>* are considered as invalid redefinitions
Line 330:
END-DISPLAY
STOP RUN.
END PROGRAM case-sensitivity.</
=={{header|CoffeeScript}}==
<
dog="Benjamin"
Dog = "Samba"
DOG = "Bernie"
console.log "The three dogs are names #{dog}, #{Dog}, and #{DOG}."
</syntaxhighlight>
output
<syntaxhighlight lang=text>
> coffee foo.coffee
The three dogs are names Benjamin, Samba, and Bernie.
</syntaxhighlight>
=={{header|Common Lisp}}==
<
(format nil "There is just one dog named ~a." dog))
; in: LAMBDA NIL
Line 361:
; compilation unit finished
; caught 2 STYLE-WARNING conditions
"There is just one dog named Bernie."</
These are the style warnings from [[SBCL]]. Other implementations of Common Lisp might give different warnings.
=={{header|Crystal}}==
<
Dog = "Samba"
DOG = "Bernie"
puts "The three dogs are named #{dog}, #{Dog} and #{DOG}."</
Note that in Crystal, variables with all-caps identifiers (like <code>DOG</code>) are always constants.
Line 377:
=={{header|D}}==
<
void main() {
Line 386:
writefln("There are three dogs named ",
dog, ", ", Dog, ", and ", DOG, "'");
}</
Output:
<pre>There are three dogs named Benjamin, Samba, and Bernie'</pre>
Line 393:
A register name has only one character, so this example uses 'd' and 'D'.
<
[Samba]sD
[The two dogs are named ]P ldP [ and ]P lDP [.
]P</
{{Out}}
Line 404:
Delphi is case insensitive.
<
{$APPTYPE CONSOLE}
Line 415:
DOG := 'Bernie';
Writeln('There is just one dog named ' + dog);
end.</
Output:
Line 421:
=={{header|DWScript}}==
<
var dog : String;
Line 428:
DOG := 'Bernie';
PrintLn('There is just one dog named ' + dog);</
Output:
Line 434:
=={{header|Déjà Vu}}==
<
local :Dog "Samba"
local :DOG "Bernie"
!print( "There are three dogs named " dog ", " Dog " and " DOG "." )</
{{out}}
<pre>There are three dogs named Benjamin, Samba and Bernie.</pre>
=={{header|EchoLisp}}==
<
(define dog "Benjamin")
(define Dog "Samba")
Line 450:
(printf "The three dogs are named %a, %a and %a. " dog Dog DOG)
The three dogs are named Benjamin, Samba and Bernie.
</syntaxhighlight>
=={{header|Elena}}==
In ELENA identifiers are case sensitive.
ELENA 4.x:
<
public program()
Line 463:
var DOG := "Bernie";
console.printLineFormatted("The three dogs are named {0}, {1} and {2}", dog, Dog, DOG)
}</
{{out}}
<pre>
Line 471:
=={{header|Elixir}}==
While Elixir's identifiers are case-sensitive, they generally must start with a lowercase letter. Capitalized identifiers are reserved for modules.
<
doG = "Samba"
dOG = "Bernie"
IO.puts "The three dogs are named #{dog}, #{doG} and #{dOG}."</
{{out}}
Line 483:
=={{header|Erlang}}==
Erlang variables are case sensitive but must start with an uppercase letter.
<
-module( case_sensitivity_of_identifiers ).
Line 493:
DOG = "Bernie",
io:fwrite( "The three dogs are named ~s, ~s and ~s~n", [dog, Dog, DOG] ).
</syntaxhighlight>
{{out}}
Line 503:
=={{header|Euphoria}}==
{{works with|Euphoria|4.0.0}}
<
sequence dog = "Benjamin"
sequence Dog = "Samba"
sequence DOG = "Bernie"
printf( 1, "The three dogs are named %s, %s and %s\n", {dog, Dog, DOG} )</
=={{header|F Sharp|F#}}==
F# is case-sensitive.
<
let Dog = "Samba"
let DOG = "Bernie"
printfn "There are three dogs named %s, %s and %s" dog Dog DOG</
=={{header|Factor}}==
Factor identifiers are case-sensitive.
<
IN: scratchpad
[let
Line 525:
"Bernie" :> DOG
{ dog Dog DOG } "There are three dogs named %s, %s, and %s." vprintf
]</
{{out}}
<pre>
Line 532:
=={{header|Forth}}==
<
: Dog ." Samba" ;
: dog ." Bernie" ;
: HOWMANYDOGS ." There is just one dog named " DOG ;
HOWMANYDOGS</
{{out}}
<pre>There is just one dog named Bernie</pre>
Line 543:
{{works with|Fortran|90 and later}}
Fortran is case insensitive, and so the three "dog" variants name the same variable - which therefore is multiply declared and will likely evoke a compiler complaint.
<
implicit none
Line 558:
end if
end program Example</
Output:
<pre> There is just one dog named Bernie</pre>
=={{header|FreeBASIC}}==
<
' FreeBASIC is case-insensitive
Line 571:
DOG = "Bernie"
Print "There is just one dog, named "; dog
Sleep</
{{out}}
Line 580:
=={{header|Frink}}==
Frink is case-sensitive.
<
Dog = "Samba"
DOG = "Bernie"
println["There are three dogs named $dog, $Dog and $DOG"]</
=={{header|Gambas}}==
Line 589:
Gambas in case insensitive
<
Dim dog As String
Line 597:
Print "There is just one dog, named "; dog
End</
Output:
<pre>
Line 604:
=={{header|GAP}}==
<
ThreeDogs := function()
local dog, Dog, DOG;
Line 618:
ThreeDogs();
# The three dogs are named Benjamin, Samba and Bernie</
=={{header|Go}}==
Go is case sensitive. Further, visibility depends on case. See the Go entry under the [[Scope_modifiers#Go|Scope modifiers]] task.
<
import "fmt"
Line 640:
// the variables really represent different places in memory.
return map[*string]int{&dog: 1, &Dog: 1, &DOG: 1}
}</
<
import (
Line 687:
d[&DOG] = 1
fmt.Println("There are", len(d), "dogs.")
}</
{{out}}
<pre>
Line 708:
=={{header|Groovy}}==
Solution:
<
println (dog == DOG ? "There is one dog named ${dog}" : "There are three dogs named ${dog}, ${Dog} and ${DOG}.")</
Output:
Line 717:
Identifiers are case sensitive in Haskell, but must start with a lower case letter.
<
main = printf "The three dogs are named %s, %s and %s.\n" dog dOG dOg
where dog = "Benjamin"
dOG = "Samba"
dOg = "Bernie"</
=={{header|Icon}} and {{header|Unicon}}==
The program below demonstrates the three dog task. All variants of Icon/Unicon have case sensitive variable names. But if one wasn't this would find it.
<
dog := "Benjamin"
Line 737:
write("The three dogs are named ", dog, ", ", Dog, " and ", DOG, ".")
end</
=={{header|J}}==
<
dog=: 'Benjamin'
Dog=: 'Samba'
DOG=: 'Bernie'
'The three dogs are named ',dog,', ',Dog,', and ',DOG
The three dogs are named Benjamin, Samba, and Bernie </
=={{header|Java}}==
<
String Dog = "Samba"; //in general, identifiers that start with capital letters are class names
String DOG = "Bernie"; //in general, identifiers in all caps are constants
//the conventions listed in comments here are not enforced by the language
System.out.println("There are three dogs named " + dog + ", " + Dog + ", and " + DOG + "'");</
=={{header|JavaScript}}==
Javascript is case sensitive.
<
var Dog = "Samba";
var DOG = "Bernie";
document.write("The three dogs are named " + dog + ", " + Dog + ", and " + DOG + ".");</
=={{header|jq}}==
Line 765:
'''Function parameters''':
<
"The three dogs are named \(dog), \(Dog), and \(DOG)." ;
task("Benjamin"; "Samba"; "Bernie")</
{{Out}}
Line 775:
'''Variable names''':
<
| "The three dogs are named \($dog), \($Dog), and \($DOG)."</
{{out}}
As above.
Line 783:
{{works with|Julia|0.6}}
Variable names are case sensitive.
<
if dog === Dog
Line 789:
else
println("The three dogs are: ", dog, ", ", Dog, " and ", DOG)
end</
{{out}}
Line 797:
=={{header|K}}==
<syntaxhighlight lang=k>
dog: "Benjamin"
Dog: "Samba"
Line 803:
"There are three dogs named ",dog,", ",Dog," and ",DOG
"There are three dogs named Benjamin, Samba and Bernie"
</syntaxhighlight>
=={{header|Kotlin}}==
Kotlin is case-sensitive though (as in Java) the convention is for local variable names to begin with a lower case letter. The second and third identifiers would therefore be unlikely to be used in practice.
<
val dog = "Benjamin"
val Dog = "Samba"
val DOG = "Bernie"
println("The three dogs are named $dog, $Dog and $DOG")
}</
{{out}}
Line 821:
=={{header|Lasso}}==
Lasso is not case sensitive for names
<
local(dog = 'Benjamin')
local(Dog = 'Samba')
Line 827:
stdoutnl('There is just one dog named ' + #dog)
</syntaxhighlight>
Output:
<pre>There is just one dog named Bernie</pre>
Same with string comparisons. (Lasso maps can only contain unique keys)
<
local(dogs = map(
'dog' = 'Benjamin',
Line 838:
'DOG' = 'Bernie'
))
stdoutnl(#dogs -> size)</
Output:
<pre>1</pre>
To get case sensitivity we need to use bytes
<
local(dogs = map(
bytes('dog') = 'Benjamin',
Line 852:
stdoutnl(#dogs -> size)
stdoutnl(#dogs -> find(bytes('Dog')))</
Output:
<pre>3
Line 859:
=={{header|Liberty BASIC}}==
NB the IDE warns you that there are similar variables named dog$, Dog$ & DOG$
<syntaxhighlight lang=lb>
dog$ = "Benjamin"
Dog$ = "Samba"
Line 866:
end
</syntaxhighlight>
The three dogs are Benjamin, Samba and Bernie.
=={{header|Lua}}==
<
Dog = "Samba"
DOG = "Bernie"
print( "There are three dogs named "..dog..", "..Dog.." and "..DOG.."." )</
<pre>There are three dogs named Benjamin, Samba and Bernie.</pre>
Line 882:
Types in Enumeration are case sensitive, identifiers are not case sensitive.
<
MoDuLe CheckIT {
\\ keys as case sensitive if they are strings
Line 909:
}
Checkit
</syntaxhighlight>
=={{header|Maple}}==
<syntaxhighlight lang=text>> dog, Dog, DOG := "Benjamin", "Samba", "Bernie":
> if nops( { dog, Dog, DOG } ) = 3 then
> printf( "There are three dogs named %s, %s and %s.\n", dog, Dog, DOG )
Line 920:
> printf( "There is one dog named %s.\n", dog )
> end if:
There are three dogs named Benjamin, Samba and Bernie.</
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<
"The three dogs are named "<> dog <>", "<> Dog <>" and "<> DOG
-> "The three dogs are named Benjamin, Samba and Bernie"</
=={{header|MATLAB}} / {{header|Octave}}==
<
Dog = 'Samba';
DOG = 'Bernie';
printf('There are three dogs %s, %s, %s.\n',dog, Dog, DOG); </
Output
Line 941:
=={{header|Maxima}}==
<
a: 1$
A: 2$
is(a = A);
false</
=={{header|min}}==
{{works with|min|0.19.3}}
min's symbols are case sensitive.
<
"Samba" :Dog
"Bernie" :DOG
"There are three dogs named $1, $2, and $3." (dog Dog DOG)=> % print</
{{out}}
<pre>
Line 962:
=={{header|MiniScript}}==
<
Dog = "Samba"
DOG = "Bernie"
print "There are three dogs named " + dog + ", " + Dog + " and " + DOG</
=={{header|Modula-2}}==
<
IMPORT InOut;
Line 982:
InOut.WriteString ("Three happy dogs.");
InOut.WriteLn
END dog.</
=={{header|Nanoquery}}==
<
Dog = "Samba"
DOG = "Bernie"
print format("The three dogs are named %s, %s, and %s.\n", dog, Dog, DOG)</
{{out}}
<pre>The three dogs are named Benjamin, Samba, and Bernie.</pre>
=={{header|Nemerle}}==
<
def Dog = "Samba";
def DOG = "Bernie";
WriteLine($"The three dogs are named $dog, $Dog, and $DOG");</
=={{header|NESL}}==
NESL is completely case-insensitive.
<
Dog = "Samba";
DOG = "Bernie";
"There is just one dog, named " ++ dog;</
{{out}}
<pre>it = "There is just one dog, named Bernie" : [char]</pre>
Line 1,010:
=={{header|NetRexx}}==
NetRexx is not case sensitive:
<
options replace format comments java crossref symbols nobinary
Line 1,025:
return
</syntaxhighlight>
'''Output:'''
<pre>
Line 1,040:
With these rules, we don’t get one dog or three dogs: we get two dogs!
<
(dog, Dog, DOG) = ("Benjamin", "Samba", "Bernie")
Line 1,051:
echo "There are two dogs: ", dog, " and ", DOG
else:
echo "There are three dogs: ", dog, ", ", Dog, " and ", DOG</
{{out}}
Line 1,058:
=={{header|Oberon-2}}==
{{Works with| oo2c Version 2}}
<
MODULE CaseSensitivity;
IMPORT
Line 1,071:
Out.Ln
END CaseSensitivity.
</syntaxhighlight>
{{Out}}
<pre>
Line 1,080:
Objeck is case sensitive
<
function : Main(args : String[]) ~ Nil {
dog := "Benjamin";
Line 1,087:
"The three dogs are named {$dog}, {$Dog}, and {$DOG}."->PrintLine();
}
}</
=={{header|OCaml}}==
Line 1,093:
Identifiers in OCaml are lettercase sensitive, but the first letter has to be lowercase.
<
let dog = "Benjamin" in
let dOG = "Samba" in
let dOg = "Bernie" in
Printf.printf "The three dogs are named %s, %s and %s.\n" dog dOG dOg</
=={{header|Oforth}}==
Line 1,103:
Oforth is case-sensitive.
<
| dog Dog DOG |
Line 1,110:
"Bernie" ->DOG
System.Out "The three dogs are named " << dog << ", " << Dog << " and " << DOG << "." << cr ;</
=={{header|Ol}}==
<
(define dog "Benjamin")
(define Dog "Samba")
Line 1,119:
(print "The three dogs are named " dog ", " Dog " and " DOG ".\n")
</syntaxhighlight>
{{Out}}
<pre>
Line 1,127:
=={{header|PARI/GP}}==
<
Dog="Samba";
DOG="Bernie";
printf("The three dogs are named %s, %s, and %s.", dog, Dog, DOG)</
=={{header|Pascal}}==
Line 1,136:
=={{header|Perl}}==
<
$dog='Benjamin';
$Dog='Samba';
$DOG='Bernie';
print "The three dogs are named $dog, $Dog, and $DOG \n"</
=={{header|Phix}}==
Line 1,146:
Phix is case sensitive
<!--<
<span style="color: #004080;">sequence</span> <span style="color: #000000;">dog</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"Benjamin"<span style="color: #0000FF;">,</span>
<span style="color: #000000;">Dog</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"Samba"<span style="color: #0000FF;">,</span>
<span style="color: #000000;">DOG</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"Bernie"</span>
<span style="color: #7060A8;">printf<span style="color: #0000FF;">(</span> <span style="color: #000000;">1<span style="color: #0000FF;">,</span> <span style="color: #008000;">"The three dogs are named %s, %s and %s\n"<span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{<span style="color: #000000;">dog<span style="color: #0000FF;">,</span> <span style="color: #000000;">Dog<span style="color: #0000FF;">,</span> <span style="color: #000000;">DOG<span style="color: #0000FF;">}</span> <span style="color: #0000FF;">)
<!--</
{{out}}
Line 1,159:
=={{header|PicoLisp}}==
<
(prinl "The three dogs are named " dog ", " Dog " and " DOG) )</
Output:
<pre>The three dogs are named Benjamin, Samba and Bernie</pre>
=={{header|PL/I}}==
<
/*********************************************************************
* Program to show that PL/I is case-insensitive
Line 1,176:
DOG = "Bernie";
Put Edit(dog,Dog,DOG)(Skip,3(a,x(1)));
End;</
'''Output'''
<pre>Bernie Bernie Berni</pre>
Line 1,182:
=={{header|Plain English}}==
Plain English is NOT case sensitive.
<
Start up.
Put "Benjamin" into a DOG string.
Line 1,189:
Write "There is just one dog named " then the DOG on the console.
Wait for the escape key.
Shut down.</
{{out}}
<pre>
Line 1,197:
=={{header|PowerShell}}==
PowerShell is not case sensitive.
<
$dog = "Benjamin"
$Dog = "Samba"
Line 1,203:
"There is just one dog named {0}." -f $dOg
</syntaxhighlight>
{{Out}}
<pre>
Line 1,211:
=={{header|Prolog}}==
In Prolog, the initial of a variable must be a uppercase letter. So the task can't be completed but we can write this code :
<
DoG = 'Benjamin',
Dog = 'Samba',
DOG = 'Bernie',
format('The three dogs are named ~w, ~w and ~w.~n', [DoG, Dog, DOG]).
</syntaxhighlight>
The output is :
<pre>?- three_dogs.
Line 1,225:
=={{header|PureBasic}}==
<
Dog$="Samba"
DOG$="Bernie"
Debug "There is just one dog named "+dog$</
=={{header|Python}}==
Python names are case sensitive:
<
>>> print ('The three dogs are named ',dog,', ',Dog,', and ',DOG)
The three dogs are named Benjamin , Samba , and Bernie
>>> </
=={{header|Quackery}}==
<
[ $ 'Samba' ] is Dog ( --> $ )
Line 1,247:
dog echo$ say ', '
Dog echo$ say ', and '
DOG echo$ say '.' cr</
{{out}}
<pre>
Line 1,254:
=={{header|R}}==
<
Dog <- 'Samba'
DOG <- 'Bernie'
Line 1,267:
cat('.\n')
# In one line it would be:
# cat('The three dogs are named ', dog, ', ', Dog, ' and ', DOG, '.\n', sep = '')</
Output:
Line 1,276:
=={{header|Racket}}==
The default setting for the Racket reader is to be case sensitive:
<
#lang racket
(define dog "Benjamin")
Line 1,285:
(displayln (~a "There is one dog named " DOG "."))
(displayln (~a "The three dogs are named " dog ", " Dog ", and, " DOG ".")))
</syntaxhighlight>
Output:
<pre>
Line 1,292:
If you need case insensitive identifiers, then use #ci to turn on case insensitivity:
<
#lang racket
#ci(module dogs racket
Line 1,302:
(displayln (~a "The three dogs are named " dog ", " Dog ", and, " DOG "."))))
(require 'dogs)
</syntaxhighlight>
Output:
<pre>
Line 1,310:
=={{header|Raku}}==
(formerly Perl 6)
<syntaxhighlight lang=raku
my $Dog = 'Samba';
my $DOG = 'Bernie';
say "The three dogs are named $dog, $Dog, and $DOG."</
The only place that Raku pays any attention to the case of identifiers is that, for certain error messages, it will guess that an identifier starting lowercase is probably a function name, while one starting uppercase is probably a type or constant name. But this case distinction is merely a convention in Raku, not mandatory:
<syntaxhighlight lang=raku
sub Dog() { 'Samba' }
my &DOG = { 'Bernie' }
say "The three dogs are named {dog}, {Dog}, and {DOG}."</
=={{header|Retro}}==
Retro is case sensitive.
<
: Dog ( -$ ) "Samba" ;
: DOG ( -$ ) "Bernie" ;
DOG Dog dog "The three dogs are named %s, %s, and %s.\n" puts</
=={{header|REXX}}==
===simple variables===
The REXX language is case insensitive (with respect to simple variables).
<
/* ┌──◄── all 3 left─hand side REXX variables are identical (as far as assignments). */
Line 1,347:
else say 'There is just one dog named:' dog"."
/*stick a fork in it, we're all done. */</
'''output'''
<pre>
Line 1,357:
===compound variables===
However, the REXX language is case sensitive (with respect to compound variables, or indices).
<
/* ┌──◄── all 3 indices (for an array variable) are unique (as far as array index). */
Line 1,375:
_= 'doG'; say "dogname.doG=" dogname._ /* " " " " mixed doG*/
/*stick a fork in it, we're all done. */</
'''output'''
<pre>
Line 1,387:
=={{header|Ring}}==
<
dog = "Benjamin"
doG = "Smokey"
Line 1,393:
DOG = "Bernie"
see "The 4 dogs are : " + dog + ", " + doG + ", " + Dog + " and " + DOG + "."
</syntaxhighlight>
=={{header|Ruby}}==
Ruby gives a special meaning to the first letter of a name. A lowercase letter starts a local variable. An uppercase letter starts a constant. So <tt>dog</tt> is a local variable, but <tt>Dog</tt> and <tt>DOG</tt> are constants. To adapt this task to Ruby, I added <tt>dOg</tt> and <tt>doG</tt> so that I have more than one local variable.
<
dog = "Benjamin"
dOg = "Dogley"
Line 1,411:
puts "The local variables are %s." % local_variables.join(", ")
puts "The constants are %s." % constants.join(", ")
end</
Output: <pre>There are 5 dogs named Benjamin, Dogley, Fido, Samba, Bernie.
Line 1,419:
=={{header|Run BASIC}}==
<
dog$ = "Benjamin"
doG$ = "Smokey"
Line 1,425:
DOG$ = "Bernie"
print "The 4 dogs are "; dog$; ", "; doG$; ", "; Dog$; " and "; DOG$; "."
</syntaxhighlight>
=={{header|Rust}}==
Rust style dictates that identifiers should be written in snake case, e.g. <tt>big_dog</tt>, <tt>small_dog</tt>; whereas types (structs and enums) should be written in camel case, e.g. <tt>BigDog</tt>, <tt>SmallDog</tt>. Failing to comply with this standard does not cause a compiler error, but it will trigger a compiler warning, and the culture is very strongly towards compliance with this standard.
<
let dog = "Benjamin";
let Dog = "Samba";
let DOG = "Bernie";
println!("The three dogs are named {}, {} and {}.", dog, Dog, DOG);
}</
This triggers two warnings at compilation:
<syntaxhighlight lang=text><anon>:3:9: 3:12 warning: variable `Dog` should have a snake case name such as `dog`, #[warn(non_snake_case)] on by default
<anon>:3 let Dog = "Samba";
^~~
<anon>:4:9: 4:12 warning: variable `DOG` should have a snake case name such as `dog`, #[warn(non_snake_case)] on by default
<anon>:4 let DOG = "Bernie";
^~~</
The resulting program will compile and run just fine, producing the output:
<syntaxhighlight lang=text>The three dogs are named Benjamin, Samba and Bernie.</
=={{header|Sather}}==
Line 1,454:
all uppercase.
<
main is
dog ::= "Benjamin";
Line 1,462:
dog, Dog, DOG);
end;
end;</
Outputs:
Line 1,469:
=={{header|Scala}}==
<
val Dog = "Samba"
val DOG = "Bernie"
println("There are three dogs named " + dog + ", " + Dog + ", and " + DOG + ".")</
Output:
<pre>There are three dogs named Benjamin, Samba, and Bernie.</pre>
Line 1,478:
=={{header|Scheme}}==
Output may differ depending on implementation.
<
(define Dog "Samba")
(define DOG "Bernie")
Line 1,492:
(display DOG)
(display ".")
(newline)))</
=={{header|Seed7}}==
<
const string: dog is "Benjamin";
Line 1,504:
begin
writeln("The three dogs are named " <& dog <& ", " <& Dog <& " and " <& DOG <& ".");
end func;</
=={{header|SenseTalk}}==
As a People Oriented Programming language, SenseTalk's variable names are case-insensitive.
<
set dog to "Benjamin"
set Dog to "Samba"
Line 1,514:
put !"There is just one dog named [[dog]]."
</syntaxhighlight>
{{out}}
<pre>There is just one dog named Bernie.</pre>
=={{header|SETL}}==
<
Dog := 'Samba';
DOG := 'Bernie';
print( 'There is just one dog named', dOg );</
{{out}}
<pre>There is just one dog named Bernie</pre>
=={{header|Sidef}}==
<
var Dog = 'Samba';
var DOG = 'Bernie';
say "The three dogs are named #{dog}, #{Dog}, and #{DOG}.";</
{{out}}
<pre>The three dogs are named Benjamin, Samba, and Bernie.</pre>
Line 1,536:
=={{header|Simula}}==
Simula identifiers are case-insensitive, and the compiler will indignantly reject a program that tries to declare multiple variables with names differing only in case. (Same with ''key words'': Case of a character in Simula ''code'' generally only matters in [http://simula67.at.ifi.uio.no/Standard-86/chap_1.htm| a simple string or a character constant].)
<
text dog;
dog :- blanks( 8 );
Line 1,545:
outtext( dog );
outimage
end</
{{out}}
<pre>There is just one dog, named Bernie</pre>
Line 1,554:
Smalltalk's symbols are case sensitive.
<
dog := 'Benjamin'.
Dog := 'Samba'.
DOG := 'Bernie'.
( 'The three dogs are named %1, %2 and %3' %
{ dog . Dog . DOG } ) displayNl.</
Outputs:
Line 1,566:
=={{header|SNOBOL4}}==
<
Dog = 'Samba'
dog = 'Bernie'
OUTPUT = 'The three dogs are named ' DOG ', ' Dog ', and ' dog
END</
{{out}}
<pre>The three dogs are named Benjamin, Samba, and Bernie</pre>
Line 1,576:
=={{header|Standard ML}}==
Standard ML is case sensitive.
<
val dog = "Benjamin"
val Dog = "Samba"
Line 1,582:
in
print("The three dogs are named " ^ dog ^ ", " ^ Dog ^ ", and " ^ DOG ^ ".\n")
end;</
{{out}}
<pre>The three dogs are named Benjamin, Samba, and Bernie.</pre>
Line 1,589:
Stata is case-sensitive.
<
. local Dog Samba
. local DOG Bernie
. display "The three dogs are named $_dog, $_Dog, and $_DOG."
The three dogs are named Benjamin, Samba, and Bernie.</
=={{header|Swift}}==
<
let Dog = "Samba"
let DOG = "Bernie"
println("The three dogs are named \(dog), \(Dog), and \(DOG).")</
=={{header|Tcl}}==
Tcl variable names are case sensitive:
<
set Dog "Samba"
set DOG "Bernie"
puts "The three dogs are named $dog, $Dog and $DOG"</
Which prints...
<pre>The three dogs are named Benjamin, Samba and Bernie</pre>
Line 1,614:
{{works with|QBasic}}
True Basic is case-insensitive
<
LET Dog$ = "Samba"
LET DOG$ = "Bernie"
PRINT "There is just one dog, named "; dog$
END</
=={{header|UNIX Shell}}==
<
Dog="Samba"
DOG="Bernie"
echo "The three dogs are named $dog, $Dog and $DOG."</
The three dogs are named Benjamin, Samba and Bernie.
Line 1,631:
=={{header|Ursa}}==
Ursa names are case sensitive:
<
> set dog "Benjamin"
> set Dog "Samba"
Line 1,637:
> out "The three dogs are named " dog ", " Dog ", and " DOG endl console
The three dogs are named Benjamin, Samba, and Bernie
></
=={{header|VBA}}==
VBA is case sensitive case insensitive. The variable names 'dog', 'Dog' and 'DOG' can not co-exist.
<
'VBA does not allow variables that only differ in case
'The VBA IDE vbe will rename variable 'dog' to 'DOG'
Line 1,650:
DOG = "Bernie"
Debug.Print "There is just one dog named " & DOG
End Sub</
<pre>There is just one dog named Bernie</pre>
=={{header|Wren}}==
Identifiers in Wren are case sensitive.
<
var Dog = "Samba"
var DOG = "Bernie"
System.print("The three dogs are named %(dog), %(Dog) and %(DOG).")</
{{out}}
Line 1,667:
=={{header|XBS}}==
In XBS variable names are case-sensitive.
<
set DOG="Samba";
set Dog="Bernie";
log(`The three dogs are named {dog}, {DOG} and {Dog}.`);</
{{out}}
<pre>
Line 1,678:
=={{header|XLISP}}==
XLISP is entirely case-insensitive. The user can decide whether to have the system print symbols, etc., in capitals or in lower case, by assigning to the variable <tt>*PRINT-CASE*</tt>.
<
(SETQ Dog 'SAMBA)
(SETQ dog 'BERNIE)
(DISPLAY `(THERE IS JUST ONE DOG NAMED ,DOG))</
There is, in any event, only one dog.
<pre>(THERE IS JUST ONE DOG NAMED BERNIE)</pre>
Line 1,697:
=={{header|Yabasic}}==
Yabasic names are case sensitive:
<
dog$ = "Benjamin"
Dog$ = "Samba"
DOG$ = "Bernie"
print "The three dogs are named ", dog$, ", ", Dog$, " and ", DOG$
end</
=={{header|zkl}}==
<
{{out}}
<pre>
Line 1,716:
=={{header|ZX Spectrum Basic}}==
<
20 PRINT "There is just one dog named ";d$</
{{omit from|360 Assembly}}
{{omit from|6502 Assembly|Depends on assembler. Some have a -nocase command line argument that ignores sensitivity of labels.}}
|