Gp2x Community Game Contest Only 3 Days Left!


sam fisher posted on Dec 14 2006 at 08:32 AM said:
nickspoon posted on Dec 13 2006 at 09:23 PM said:
A break; ends a loop or exits a switch. It's standard C.
I know, I just don't usually use them, they are in fenix aswell. Just that if your not sure about something, it's always best to ask, you know? So that you do not make mistakes lol.

It depends if you want your code served with meatballs. Break is only provided as a curtesy to those who coded in basic or other early sequential language.
 
Last edited by a moderator:
Magnulus posted on Dec 13 2006 at 11:39 PM said:
And we'll try to set up some sort of voting system that's as secure as possible by new year's, when everyone has had time to play everything. Without having discussed this with Psy or anything, I think we may go for that Grand Prix style thing where everyone writes a list of all the eleven games, giving them a unique score from zero to ten. It's basically like a numbered top eleven list with the numbers reversed.
Everyone who wants to vote makes one of those and submits it (maybe through this forum) and we'll check them all and stuff. Suspicious entries would be investigated further in order to prevent cheating. There's ALWAYS a way to cheat, we just have to figure out how best to prevent it. The only way to get close to eliminating that chance would be to survey the voting personally. You can't rely on computers for that... It's difficult.
Cookies combined with IP monitoring?

icurafu posted on Dec 13 2006 at 11:46 PM said:
sam fisher posted on Dec 14 2006 at 08:32 AM said:
nickspoon posted on Dec 13 2006 at 09:23 PM said:
A break; ends a loop or exits a switch. It's standard C.
I know, I just don't usually use them, they are in fenix aswell. Just that if your not sure about something, it's always best to ask, you know? So that you do not make mistakes lol.

It depends if you want your code served with meatballs. Break is only provided as a curtesy to those who coded in basic or other early sequential language.
So Basic was before C then? Hmmmm. Are you sure thats the only reason why break is in there, i mean its obvious that some loops may of required it to end, so not having it would be stupid.
 
Last edited by a moderator:
break is 100% useless for loops, there's always a way to add an extra condition there. However, I can't see a work around for it when using switch cases?

- Alex
 
I have used it for 'for' loops when there was no point going through another 100 iterations when it'd already served its purpose after the second.
 
sam fisher posted on Dec 14 2006 at 11:43 AM said:
wouldn't it be more efficient, technically, to use a break rather than checking another condition?

There is always another way. If you need to use a break for efficency, than you are using the wrong logic loop.

You can use it to make a few shortcuts to begin with when you're not c;er about everything, but it's considered a bad habit. You'll have to get rid of it before you work in the industry.

also good to avoid "goto" as well.
 
Last edited by a moderator:
sam fisher posted on Dec 13 2006 at 07:43 PM said:
wouldn't it be more efficient, technically, to use a break rather than checking another condition?

It depends on what type of loop I think Alex is talking about a while or do while loop when a condition is met then stop the loop the only reason I could think of using a break in a loop is a for loop like when you are searching through an array to find something and when you find it use break to stop but you can still use a while loop to do this so I can see where Alex is coming from.
 
Last edited by a moderator:
Anyone of you guys want to help me set up a development environment for the GP2X? As, basically, Ive been trying and it just wont compile anything for the GP2X. (Ive tried everything in the Wiki over 20x, it doesn't work)
 
GP2X_Coder posted on Dec 13 2006 at 07:57 PM said:
the only reason I could think of using a break in a loop is a for loop like when you are searching through an array to find something and when you find it use break to stop
Why not do something like this instead?

Code:
int array[] = {1, 8, 7, 11};
int arrayLength = 4;
int index = -1;

int k;

for(k = 0; k < arrayLength && index == -1; k++) {
  if(array[k] == SOME_VALUE) index = k;
}

- Alex :)
 
Last edited by a moderator:
sam fisher posted on Dec 14 2006 at 11:57 AM said:
Jesus, I don't even know a language that supports Goto lol.

I noticed it available in available in ANSI C. And it was there for Turbo C++ (released 1988), but that's the last time I ever used it.
 
Last edited by a moderator:
There was a Java SDK addon that had goto. Yes, in an OOL they have goto. I dont know, some sick tard lol.
 
icurafu posted on Dec 14 2006 at 02:01 AM said:
sam fisher posted on Dec 14 2006 at 11:57 AM said:
Jesus, I don't even know a language that supports Goto lol.

I noticed it available in available in ANSI C. And it was there for Turbo C++ (released 1988), but that's the last time I ever used it.
ANSI C has it lol? I really should get back to reading that book.
 
Last edited by a moderator:
Alex. posted on Dec 14 2006 at 01:59 AM said:
GP2X_Coder posted on Dec 13 2006 at 07:57 PM said:
the only reason I could think of using a break in a loop is a for loop like when you are searching through an array to find something and when you find it use break to stop
Why not do something like this instead?

Code:
int array[] = {1, 8, 7, 11};
int arrayLength = 4;
int index = -1;

int k;

for(k = 0; k < arrayLength && index == -1; k++) {
  if(array[k] == SOME_VALUE) index = k;
}

- Alex :)
Because it's quicker, easier and works just as well?

Plus, there's nothing better to use in switch statements.

As for goto, it's only considered bad practice because it encourages disorganised coding.
 
Last edited by a moderator:
Back
Top