Exit Sub in C#

  • Thread starter Thread starter Tina
  • Start date Start date
Steve said:
One thing I've learnt is that when there is an error, no matter how
much I think it is with the tool I'm using or language I'm writing in,
99.9% of the time the mistake is mine and I probably need to check
what I've done or do a little more research so I'm more familiar with
the tools I'm using.

Wow, only 99.9%? With me it's bang on 100%!
 
Wow, only 99.9%? With me it's bang on 100%!

You have never programmed with an incorrect compiler I see. :)

Fortunally, compiler bugs are less common today, but they still exist.
It is probably more like 99.99% though. I have personally only
triggered one compiler bug in my lifetime.

I have also seen a few other strange things, like the VS.Net debugger
following the wrong path in an if statement. (I think it was fixed by
restarting VS and recompiling everything from scratch)
 
Tina said:
Wow, I guess I started a religious "return debate". Actually return; was
the first thing I tried
but the compiler flagged it. I find that in C# the compiler will
occasionally flag something as an
error that is not an error. But then when something else is changed, that
is seemingly unrelated, the
flag goes away. This has happend four or five times.

The flag on the return; (the only error left) went away when I tightened up
some white space.

VB never did that.

thanks,
T

You can get a warning with return; if you have "unreachable" code. For
example:

void Foo(int bar)
{
bar++;
return;
bar = 5 * 7;
}

The compiler should bug you about an unreachable code path.

As far as a warning/error going away because of white space. That
won't/shouldn't happen in C#. C# unlike VB doesn't care about white space.


i = 10;

is the same as

i
=
10
;


Jim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There's no place like 127.0.0.1
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
JimD
Central FL, USA, Earth, Sol
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top