Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[c#]Break statement

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
wunder312355
Grandmaster Cheater
Reputation: -1

Joined: 14 May 2007
Posts: 568

PostPosted: Sat May 30, 2009 8:48 pm    Post subject: [c#]Break statement Reply with quote

Does break; have to be used in switch statements in C#?

If I don't use them, I get this error:

Quote:
Control cannot fall through from one case label ('case 1:') to another
Back to top
View user's profile Send private message
yoyonerd
Grandmaster Cheater
Reputation: 0

Joined: 26 Apr 2008
Posts: 699
Location: -->formerly yoyonerd<--

PostPosted: Sat May 30, 2009 9:37 pm    Post subject: Reply with quote

Yes, break means that's the end of the commands to do in that case.

One of the lessons in my tutorials is all about switch statements.

Link in my signature
VVVVVVVVVVVVVVV

_________________
Back to top
View user's profile Send private message AIM Address
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sat May 30, 2009 9:40 pm    Post subject: Reply with quote

Quote:
C# does not support an implicit fall through from one case label to another. The one exception is if a case statement has no code.
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sun May 31, 2009 7:14 am    Post subject: Reply with quote

slovach wrote:
Quote:
C# does not support an implicit fall through from one case label to another. The one exception is if a case statement has no code.


Wow, talk about lame. Why did they do that?
Back to top
View user's profile Send private message MSN Messenger
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Sun May 31, 2009 9:12 am    Post subject: Reply with quote

Edit : Sorry didn't read the question properly. Yes you need to break the loop.
_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Sun May 31, 2009 10:50 am    Post subject: Reply with quote

Noz3001 wrote:
slovach wrote:
Quote:
C# does not support an implicit fall through from one case label to another. The one exception is if a case statement has no code.


Wow, talk about lame. Why did they do that?
I'm wondering that too.. Now you can't do eg.
Code:
case PROCESS_NEXT:
  ++index;
case PROCESS_CURRENT:
  v.at(index)->Process();
  break;
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun May 31, 2009 12:16 pm    Post subject: Reply with quote

Yea you'd have to do:

Code:

case PROCESS_NEXT:
case PROCESS_CURRENT:
    if (i == PROCESS_NEXT)
        ++index;
    v.at(index)->Process();
    break;


Kinda dumb but w/e.

_________________
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Sun May 31, 2009 12:23 pm    Post subject: Reply with quote

This is what I'd like the syntax to be. For me it would make more sence. But maby that is just me and my crazy thinking.
select (shit)
{
case lol
{
}
}

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
iostream
How do I cheat?
Reputation: 0

Joined: 06 Apr 2009
Posts: 9
Location: georgia

PostPosted: Sun May 31, 2009 7:13 pm    Post subject: Reply with quote

yoyonerd wrote:
Yes, break means that's the end of the commands to do in that case.

One of the lessons in my tutorials is all about switch statements.

Link in my signature
VVVVVVVVVVVVVVV

you should continue those.

also @OP check out msdn as they now offer a pretty good video series that cover c# pretty well.

_________________
Don't wait up.
Back to top
View user's profile Send private message MSN Messenger
yoyonerd
Grandmaster Cheater
Reputation: 0

Joined: 26 Apr 2008
Posts: 699
Location: -->formerly yoyonerd<--

PostPosted: Sun May 31, 2009 7:59 pm    Post subject: Reply with quote

iostream wrote:
yoyonerd wrote:
Yes, break means that's the end of the commands to do in that case.

One of the lessons in my tutorials is all about switch statements.

Link in my signature
VVVVVVVVVVVVVVV

you should continue those.

also @OP check out msdn as they now offer a pretty good video series that cover c# pretty well.


I am actually, now that I'm on break, I actually have the time.

I will also start writing guides focused more on bot making programming.

You'll be able to find these in the w8baby.com programming section

_________________
Back to top
View user's profile Send private message AIM Address
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Mon Jun 01, 2009 4:26 am    Post subject: Reply with quote

iostream wrote:
yoyonerd wrote:
Yes, break means that's the end of the commands to do in that case.

One of the lessons in my tutorials is all about switch statements.

Link in my signature
VVVVVVVVVVVVVVV

you should continue those.

also @OP check out msdn as they now offer a pretty good video series that cover c# pretty well.

continue will only jump to the next statement. so in a select case it wouldn't abort the actual loop like break would.

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites