Case-sensitivity of identifiers: Difference between revisions

Add Zig example
(Added Dart)
(Add Zig example)
 
(2 intermediate revisions by 2 users not shown)
Line 187:
 
The three dogs are named Benjamin, Samba and Bernie.
 
 
=={{header|BASIC}}==
Line 194 ⟶ 193:
<syntaxhighlight lang="basic">dog$ = "Benjamin":Dog$ = "Samba":DOG$ = "Bernie":III = 254 * (DOG$ = dog$ AND Dog$ = DOG$) + 1: PRINT MID$ ("There is just one dog",256 - III) MID$ ("The three dogs are",III)" named " MID$ (dog$ + ", " + Dog$ + " and ",III)DOG$"."</syntaxhighlight>
{{out}}
<pre>There is just one dog named Bernie.</pre>
</pre>
The Apple II and Apple II plus will convert all input characters to upper case.
<pre>THERE IS JUST ONE DOG NAMED BERNIE.</pre>
</pre>
 
==={{header|BASIC256}}===
Line 207 ⟶ 204:
print "There is just one dog, named "; dog
end</syntaxhighlight>
{{out}}
<pre>There is just one dog, named Bernie</pre>
 
==={{header|BBC BASIC}}===
Line 213 ⟶ 212:
DOG$ = "Bernie"
PRINT "The three dogs are " dog$ ", " Dog$ " and " DOG$ "."</syntaxhighlight>
{{out}}
Output:
<pre>The three dogs are Benjamin, Samba and Bernie.</pre>
 
==={{header|Chipmunk Basic}}===
Chipmunk Basic is case-insensitive
<syntaxhighlight lang="qbasic">10 dog$ = "Benjamin"
20 dog$ = "Smokey"
30 dog$ = "Samba"
40 dog$ = "Bernie"
50 print "There is just one dog, named ";dog$</syntaxhighlight>
{{out}}
<pre>There is just one dog, named Bernie</pre>
 
==={{header|FreeBASIC}}===
Line 226 ⟶ 235:
Print "There is just one dog, named "; dog
Sleep</syntaxhighlight>
 
{{out}}
<pre>There is just one dog, named Bernie</pre>
<pre>
There is just one dog, named Bernie
</pre>
 
==={{header|FutureBasic}}===
FB is lettercase-insensitive and throws an error with variables or constants with identical names but of varying case. However, here's an easy work around.
<syntaxhighlight lang="futurebasic">CFDictionaryRef canines
CFDictionaryRef canines
canines = @{@"dog":@"Benjamin", @"Dog":@"Samba", @"DOG":@"Bernie"}
print "The three dogs are "; canines[@"dog"]; ", "; canines[@"Dog"]; " and "; canines[@"DOG"]; "."
 
HandleEvents</syntaxhighlight>
{{out}}
</syntaxhighlight>
<pre>There are three dogs named Benjamin, Samba and Bernie.</pre>
{{output}}
 
<pre>
==={{header|GW-BASIC}}===
There are three dogs named Benjamin, Samba and Bernie.
{{works with|PC-BASIC|any}}
</pre>
GW-BASIC is case-insensitive. GW-BASIC keyword tokens and variable names get converted to upper case in programs.
<syntaxhighlight lang="qbasic">10 dog$ = "Benjamin"
20 dog$ = "Smokey"
30 dog$ = "Samba"
40 dog$ = "Bernie"
50 print "There is just one dog, named ";dog$</syntaxhighlight>
{{out}}
<pre>There is just one dog, named Bernie</pre>
 
==={{header|Liberty BASIC}}===
{{works with|Just BASIC}}
Just BASIC and Liberty BASIC names are case sensitive
 
NB the IDE warns you that there are similar variables named dog$, Dog$ & DOG$
<syntaxhighlight lang="lb">
Line 254 ⟶ 270:
print "The three dogs are "; dog$; ", "; Dog$; " and "; DOG$; "."
 
end</syntaxhighlight>
end
{{out}}
</syntaxhighlight>
<pre>The three dogs are Benjamin, Samba and Bernie.</pre>
 
==={{header|Minimal BASIC}}===
Minimal BASIC is case-insensitive. Minimal BASIC convert all input characters to upper case.
<syntaxhighlight lang="qbasic">10 let d$ = "Benjamin"
20 let D$ = "Samba"
30 print "There is just one dog, named "; d$
40 end</syntaxhighlight>
{{out}}
<pre>THERE IS JUST ONE DOG, NAMED SAMBA</pre>
 
==={{header|MSX Basic}}===
{{works with|MSX BASIC|any}}
MSX BASIC is case-insensitive. MSX-BASIC keyword tokens and variable names get converted to upper case in programs.
<syntaxhighlight lang="qbasic">10 dog$ = "Benjamin"
20 dog$ = "Smokey"
30 dog$ = "Samba"
40 dog$ = "Bernie"
50 print "There is just one dog, named ";dog$</syntaxhighlight>
{{out}}
<pre>There is just one dog, named Bernie</pre>
 
==={{header|PureBasic}}===
Line 270 ⟶ 306:
DOG$ = "Bernie"
PRINT "There is just one dog, named "; DOG$</syntaxhighlight>
 
==={{header|Quite BASIC}}===
Quite BASIC is case-insensitive
<syntaxhighlight lang="qbasic">10 let d$ = "Benjamin"
20 let D$ = "Samba"
30 print "There is just one dog, named "; d$
40 end</syntaxhighlight>
{{out}}
<pre>There is just one dog, named Samba</pre>
 
==={{header|Run BASIC}}===
{{works with|Just BASIC}}
{{works with|Liberty BASIC}}
Run BASIC names are case sensitive
<syntaxhighlight lang="runbasic">
dog$ = "Benjamin"
Line 277 ⟶ 325:
Dog$ = "Samba"
DOG$ = "Bernie"
print "The 4 dogs are "; dog$; ", "; doG$; ", "; Dog$; " and "; DOG$; "."</syntaxhighlight>
{{out}}
</syntaxhighlight>
<pre>The 4 dogs are Benjamin, Smokey, Samba and Bernie.</pre>
 
==={{header|True BASIC}}===
Line 288 ⟶ 337:
PRINT "There is just one dog, named "; dog$
END</syntaxhighlight>
 
==={{header|XBasic}}===
XBasic in case-insensitive
<syntaxhighlight lang="qbasic">PROGRAM "Case-sensitivity"
VERSION "0.0000"
 
DECLARE FUNCTION Entry ()
 
FUNCTION Entry ()
dog$ = "Benjamin"
dog$ = "Smokey"
dog$ = "Samba"
dog$ = "Bernie"
PRINT "There is just one dog, named "; dog$
END FUNCTION
END PROGRAM</syntaxhighlight>
{{out}}
<pre>There is just one dog, named Bernie</pre>
 
==={{header|Yabasic}}===
Line 293 ⟶ 361:
<syntaxhighlight lang="yabasic">
dog$ = "Benjamin"
doG$ = "Smokey"
Dog$ = "Samba"
DOG$ = "Bernie"
print "The threefour dogs are named ", dog$, ", ", doG$, ", ", Dog$, " and ", DOG$
end</syntaxhighlight>
{{out}}
<pre>The four dogs are named Benjamin, Smokey, Samba and Bernie</pre>
 
==={{header|ZX Spectrum Basic}}===
<syntaxhighlight lang="basic">10 LET D$="Benjamin"
20 PRINT "There is just one dog named ";d$</syntaxhighlight>
 
 
 
=={{header|Batch File}}==
Line 1,764 ⟶ 1,833:
=={{header|Wren}}==
Identifiers in Wren are case sensitive.
<syntaxhighlight lang="ecmascriptwren">var dog = "Benjamin"
var Dog = "Samba"
var DOG = "Bernie"
Line 1,773 ⟶ 1,842:
The three dogs are named Benjamin, Samba and Bernie.
</pre>
 
=={{header|XBS}}==
In XBS variable names are case-sensitive.
Line 1,799 ⟶ 1,869:
switch (/c) is to detect inconsistent capitalizing of names such as
Ascii and ASCII or CpuReg and CPUReg.
 
=={{header|Zig}}==
In Zig identifiers are case-sensitive.
 
<syntaxhighlight lang="zig">const std = @import("std");
 
pub fn main() void {
const dog = "Benjamin";
const Dog = "Samba";
const DOG = "Bernie";
 
std.debug.print("The three dogs are named {s}, {s}, and {s}.\n", .{ dog, Dog, DOG });
}</syntaxhighlight>
 
{{out}}
<pre>
The three dogs are named Benjamin, Samba, and Bernie.
</pre>
 
=={{header|zkl}}==
<syntaxhighlight lang="zkl">var dog = "Benjamin", Dog = "Samba", DOG = "Bernie";</syntaxhighlight>
28

edits