473,401 Members | 2,139 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,401 software developers and data experts.

undeclare varables?

Hi,

Do I need to undeclare variables?
If yes, how?

For example I declare variables inside a while-statement.

Thanks!
Nov 17 '05 #1
4 1609
Arjen,

No, you can not undeclare variables. What are you trying to do?

The only thing you need to be worried about are instances of types that
implement the IDisposable interface, in which case, you need to call the
implementation of Dispose. To make that easier, you have the using
statement.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Arjen" <bo*****@hotmail.com> wrote in message
news:dc**********@news2.zwoll1.ov.home.nl...
Hi,

Do I need to undeclare variables?
If yes, how?

For example I declare variables inside a while-statement.

Thanks!

Nov 17 '05 #2
> What are you trying to do?
Better/cleaner code?
To make that easier, you have the using statement. I'm allready using this. ;-)

Thanks!
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> schreef
in bericht news:uU**************@TK2MSFTNGP09.phx.gbl... Arjen,

No, you can not undeclare variables. What are you trying to do?

The only thing you need to be worried about are instances of types that
implement the IDisposable interface, in which case, you need to call the
implementation of Dispose. To make that easier, you have the using
statement.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Arjen" <bo*****@hotmail.com> wrote in message
news:dc**********@news2.zwoll1.ov.home.nl...
Hi,

Do I need to undeclare variables?
If yes, how?

For example I declare variables inside a while-statement.

Thanks!


Nov 17 '05 #3
Arjen <bo*****@hotmail.com> wrote:
What are you trying to do?

Better/cleaner code?


How would undeclaring a variable give you cleaner code? If you use the
tightest scope available for a variable, I don't think there's much to
be gained beyond that.

I *do* think it's worth using the tightest scope available though - for
instance, using:

for (int i=0; i < 10; i++)
{
....
}

rather than:

int i;
for (i=0; i < 10; i++)
{
....
}

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #4
In additions, declare variables as close as possible to where they will
be used ...

Nov 17 '05 #5

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

Similar topics

4
by: synergz | last post by:
I have 2 parallel systems for php development Debian linux with apache and PHP4 and Windows XP professional with apache & PHP4 I have been in the habit of debugging on the xp machine before I...
8
by: Bo Wisén | last post by:
Hi, A project in VB6 recently worked without any problems but now it's complaining when I try to use 'Right$'. In immediate mode, when I'm typing 'print left$("123456",2)' I get the correct...
5
by: Graham Mattingley | last post by:
Hello Group, I have a small problem I dont seem to be able to fix. When I have a form which sends data using GET to an ASP page, it addes X & Y into the get string URL see below ...
3
by: Graham Mattingley | last post by:
Hi am trying to send POST varables using XMLHTTP and for me it just dont work... this is the code below, can anybody see anything wrong. My page that I have called quote123.asp will display posted...
0
by: DDE | last post by:
Hi all, I have an application (number of web Services) in which I define different application variables, like application etc. Besides that, I have a couple of assemblies containing classes and...
3
by: thinktwice | last post by:
my project contains tens of files, it compiles well . now i need to add several class implementation files to the project which are similar with the classes already exist in the project, so i add...
5
by: Joh | last post by:
I'm using mailto to open up an email that have a hyperlink in the body. The hyperlink passes two variables Name and Emailadress. The problem is that only the first variable Name show up in the...
7
by: quest007 | last post by:
Hi! I am an ASP.Net programmer. I have been assigned a task to make some modifications to an existing website that is entirely in ColdFusion. However I have no idea about ColdFusion. Is it possible...
1
by: sethsirijaya | last post by:
I already did the following things for my program; #include<iostream> #include<string> . . . string S; Problem...in my Visual Studio2003.net won't take string variables.It won't even...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.