Re: Looking for a way to convert dec to bin
- From: "Michael C" <nospam@xxxxxxxxxx>
- Date: Fri, 9 Mar 2007 09:30:37 +1100
"J French" <erewhon@xxxxxxxxxx> wrote in message
news:45efd143.4001610@xxxxxxxxxxxxxxxxxxxxxxx
I'm very much against declaring variables anywhere other than at the
top of a block, I prefer to see at a glance what is going to be used.
I've done this for years simply because it has been the common convention
but I cannot see any benefit in it at all. I've completely gone away from
this in dot net and declare all variables with the minimum possible scope.
I'm not sure about vb.net but in C# you can delare a variable that has the
scope of just a for loop, or just the scope of an if statement or just the
scope of an else statement. eg: i is declared 4 times in this code and all
are seperate variables.
for(int i = 1; i < 10; i++)
{
Console.WriteLine(i.ToString());
}
for(int i = 1; i < 10; i++)
{
Console.WriteLine(i.ToString());
}
if(Environment.TickCount == 1)
{
int i = 5;
Console.WriteLine(i.ToString());
}
else
{
int i = 2;
Console.WriteLine(i.ToString());
}
.
- Follow-Ups:
- Re: Looking for a way to convert dec to bin
- From: J French
- Re: Looking for a way to convert dec to bin
- References:
- Looking for a way to convert dec to bin
- From: Kardon Coupé
- Re: Looking for a way to convert dec to bin
- From: Kardon Coupé
- Re: Looking for a way to convert dec to bin
- From: Michael C
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: Jeff Johnson
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: J French
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: J French
- Looking for a way to convert dec to bin
- Prev by Date: Re: Applications list
- Next by Date: Re: ObjPtr not reliable on first use
- Previous by thread: Re: Looking for a way to convert dec to bin
- Next by thread: Re: Looking for a way to convert dec to bin
- Index(es):
Relevant Pages
|
Loading