473,386 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Case for variable names

I thought I read that the case for the variable names is important.

For example

Dim Wheel As Integer

Wheel here is a different variable from WHEEL.

Is this correct?

It doesn't seem to be in my code. In my code, I am changing WHEEL (just
for testing)many times and displaying Wheel. Wheel is always correct.
I would have assumed that Wheel would have been 0, since I only changed
WHEEL - if case is important.

Also, if you define a variable, does it get initialized?

For example

"Dim Wheel As Integer" is initialized to 0 and "Dim firstName As String"
is initialized to "".

Thanks,

Tom

Nov 20 '05 #1
15 1931
Thomas,
I thought I read that the case for the variable names is important. VB.NET is case insensitive: Wheel, wheel and WHEEL within one routine are
all the same identifier.

C# is case sensitive: Wheel, wheel and WHEEL within one routine all unique
identifiers.
Dim Wheel As Integer
Wheel here is a different variable from WHEEL.
Is this correct? No.
Also, if you define a variable, does it get initialized? Yes with the "default value" for that type.
"Dim Wheel As Integer" is initialized to 0 Correct the "default" value for Integer is a 0.
and "Dim firstName As String" is initialized to "". Incorrect, String is a reference type, the default value for reference
types, including string, is Nothing. However VB.NET treats a string that is
Nothing the same as "" in most cases. However calling an actually method of
firstName when its Nothing will fail!

Dim firstName As String
Debug.WriteLine(firstName.Length())

Will cause a NullReferenceException, as firstName contains Nothing.

However, the following succeeds:

Dim firstName As String
Debug.WriteLine(firstName = "")
If I want or need string variables to contain "", I will explicitly
initialize them with "" or String.Empty.

Dim firstName As String = ""

Hope this helps
Jay

"Thomas Scheiderich" <tf*@deltanet.com> wrote in message
news:40**************@deltanet.com... I thought I read that the case for the variable names is important.

For example

Dim Wheel As Integer

Wheel here is a different variable from WHEEL.

Is this correct?

It doesn't seem to be in my code. In my code, I am changing WHEEL (just
for testing)many times and displaying Wheel. Wheel is always correct.
I would have assumed that Wheel would have been 0, since I only changed
WHEEL - if case is important.

Also, if you define a variable, does it get initialized?

For example

"Dim Wheel As Integer" is initialized to 0 and "Dim firstName As String"
is initialized to "".

Thanks,

Tom

Nov 20 '05 #2
Cor
Hi Thomas,

I saw you are busy with webpages.
I thought I read that the case for the variable names is important.


Not with the language from VB (By instance for the ado.net variable names
between quotes it is)

The taste is different but for most people who uses VB that is an important
advantage from VB on other languages, VB find the propercase itself.

I hope this makes it clear?

Cor

Nov 20 '05 #3
Cor
Hi Tom,

In addition to Jay, because I saw you are busy with Webpages.

J++, Java, JavaScript, C++, C# and C are all case sensitive.
(It are all from C derived languages)

Cor
Nov 20 '05 #4
* Thomas Scheiderich <tf*@deltanet.com> scripsit:
Dim Wheel As Integer

Wheel here is a different variable from WHEEL.

Is this correct? No, Visual Basic isn't case sensitive, so the variable 'wheel' is the
same as 'Wheel' and 'WHEEL'.
Also, if you define a variable, does it get initialized?


Yes, it gets initialized with its default value, 'Nothing' for reference
types and the default value for value types (0 for numeric types, "" for
strings etc.).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
Herfried,
types and the default value for value types (0 for numeric types, "" for
strings etc.). Strings are initialized to Nothing, not "".

Jay

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c0*************@ID-208219.news.uni-berlin.de... * Thomas Scheiderich <tf*@deltanet.com> scripsit:
Dim Wheel As Integer

Wheel here is a different variable from WHEEL.

Is this correct?

No, Visual Basic isn't case sensitive, so the variable 'wheel' is the
same as 'Wheel' and 'WHEEL'.
Also, if you define a variable, does it get initialized?


Yes, it gets initialized with its default value, 'Nothing' for reference
types and the default value for value types (0 for numeric types, "" for
strings etc.).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #6
* "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> scripsit:
Strings are initialized to Nothing, not "".


Ooops. You are right!

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #7
Cor wrote:
Hi Tom,

In addition to Jay, because I saw you are busy with Webpages.

J++, Java, JavaScript, C++, C# and C are all case sensitive.
(It are all from C derived languages)
So the only language not case sensitive is VB and VB.NET?

Thanks,

Tom.

Cor


Nov 20 '05 #8
Thomas,
So the only language not case sensitive is VB and VB.NET?
If you're counting language, RPG & COBOL are not case sensitive also.

And yes! there are RPG & COBOL compilers for .NET!

Hope this helps
Jay

"Thomas Scheiderich" <tf*@deltanet.com> wrote in message
news:40**************@deltanet.com... Cor wrote:
Hi Tom,

In addition to Jay, because I saw you are busy with Webpages.

J++, Java, JavaScript, C++, C# and C are all case sensitive.
(It are all from C derived languages)

So the only language not case sensitive is VB and VB.NET?

Thanks,

Tom.

Cor

Nov 20 '05 #9
And Pascal isn't case sensitive and there is/are .net versions.

Tom

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:uz**************@TK2MSFTNGP10.phx.gbl...
Thomas,
So the only language not case sensitive is VB and VB.NET?


If you're counting language, RPG & COBOL are not case sensitive also.

And yes! there are RPG & COBOL compilers for .NET!

Hope this helps
Jay

"Thomas Scheiderich" <tf*@deltanet.com> wrote in message
news:40**************@deltanet.com...
Cor wrote:
Hi Tom,

In addition to Jay, because I saw you are busy with Webpages.

J++, Java, JavaScript, C++, C# and C are all case sensitive.
(It are all from C derived languages)

So the only language not case sensitive is VB and VB.NET?

Thanks,

Tom.

Cor


Nov 20 '05 #10
Jay B. Harlow [MVP - Outlook] wrote:
Thomas,
So the only language not case sensitive is VB and VB.NET?

If you're counting language, RPG & COBOL are not case sensitive also.

And yes! there are RPG & COBOL compilers for .NET!

Some languages just never die. :)

Tom.

Hope this helps
Jay

"Thomas Scheiderich" <tf*@deltanet.com> wrote in message
news:40**************@deltanet.com...
Cor wrote:

Hi Tom,

In addition to Jay, because I saw you are busy with Webpages.

J++, Java, JavaScript, C++, C# and C are all case sensitive.
(It are all from C derived languages)


So the only language not case sensitive is VB and VB.NET?

Thanks,

Tom.
Cor



Nov 20 '05 #11
Tom,
Yep. can't forget about good old Pascal...

Only reason I mentioned RPG & COBOL, is I have a gig on the side working
with RPG right now...

Jay

"Tom Leylan" <ge*@iamtiredofspam.com> wrote in message
news:uv****************@TK2MSFTNGP10.phx.gbl...
And Pascal isn't case sensitive and there is/are .net versions.

Tom

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:uz**************@TK2MSFTNGP10.phx.gbl...
Thomas,
So the only language not case sensitive is VB and VB.NET?


If you're counting language, RPG & COBOL are not case sensitive also.

And yes! there are RPG & COBOL compilers for .NET!

Hope this helps
Jay

"Thomas Scheiderich" <tf*@deltanet.com> wrote in message
news:40**************@deltanet.com...
Cor wrote:

> Hi Tom,
>
> In addition to Jay, because I saw you are busy with Webpages.
>
> J++, Java, JavaScript, C++, C# and C are all case sensitive.
> (It are all from C derived languages)
>
So the only language not case sensitive is VB and VB.NET?

Thanks,

Tom.
> Cor
>
>
>



Nov 20 '05 #12
Cor
Hi Jay,

You forgot to mention that when those language started only uppercases where
used and that that is long been a habbit.

But in those languages where also not things like SqlClient.SqlCommand or
the most terrible of all in my eyes the Document Object Model, in which the
uppercases are for me unpredictable.

And therefore I hate case sensetive now.

:-)

Cor

Nov 20 '05 #13
Tom,

* "Tom Leylan" <ge*@iamtiredofspam.com> scripsit:
And Pascal isn't case sensitive and there is/are .net versions.


Delphi is case sensitive (AFAIR) and there is a .NET version.

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #14
Delphi is case-insensitive (AFAIR) ... my copy is anyway...

I know there is at least one .Net version of Pascal I believe there are a
few implementations.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c0*************@ID-208219.news.uni-berlin.de...
Tom,

* "Tom Leylan" <ge*@iamtiredofspam.com> scripsit:
And Pascal isn't case sensitive and there is/are .net versions.


Delphi is case sensitive (AFAIR) and there is a .NET version.

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #15
Tom,

* "Tom Leylan" <ge*@iamtiredofspam.com> scripsit:
Delphi is case-insensitive (AFAIR) ... my copy is anyway...


Thank you. In the meantime, I had a look at the documentation and
Delphi is case insensitive too. It seems that I thought about Modula-2,
which was case sensitive (and very similar to Pascal).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: cowboyx | last post by:
Is there a way to configure PHP to use case-insensitive variable names? I'd like to do this... $dbVars = pg_query( $connection, "SELECT columnName1, columnName2, columnName3 FROM table WHERE...
32
by: Elliot Temple | last post by:
Hi I have two questions. Could someone explain to me why Python is case sensitive? I find that annoying. Also, why aren't there multiline comments? Would adding them cause a problem of some...
3
by: Peter Kellner | last post by:
I notice that on unix the default for case sensative is off which means tables created with upper case need to be referenced in sql as upper case. It seems that if the case sensative variable is...
46
by: James Harris | last post by:
Before I embark on a new long-term project I'd appreciate your advice on how to split up long names. I would like to keep the standards for command names the same as that for variable names....
6
by: crosser | last post by:
I have class written in C# with elements: 1. Private variable: aaa 2. Protected overridable property AAA the only differrence in names is case sensitivity. Is it possible to shadow...
15
by: gregory_may | last post by:
Is there any options in VS 2005 to better handle case issues in C# (Similar to VB.Net)?
17
by: Navodit | last post by:
So I have some code like: if (document.Insurance.State.selectedIndex == 1) { ifIll(); } else if (document.Insurance.State.selectedIndex == 2) { elseKan(); }
6
by: Academia | last post by:
I want to search for Dim and replace it with Dim That is, I want to change the first character of Dim variable names to upper case. I can't figure know to use Regular Expression to do that....
1
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.