Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

craphead

looping

This topic is 5711 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Urhm.... how about some specifics? If don''t mind burning in hell after you die, you can use a ''goto'' statement, otherwise, use a loop, like so:

while(loop = true)
{
// code here





} // skips back up to while

I''m guessing you already knew this, and what you''re looking for IS actually a goto. However, I think you''ll find that with good code design, you will never need to do that. Post again with what you are trying to accomplish, and maybe some code snippets. That''ll make it alot easier to help you.

By the way I THINK* the way to use a goto is like this:

line_label:
// code here
goto line_label;

...seeing how I don''t use them though, I''m not sure about that. =)

Share this post


Link to post
Share on other sites
goto ... but using it is in most cases avoidable and should be avoided coz'' it can be very confusng and causing errors if not used right. its better to break the code into several functions and classes with functions

what language are u using?

another way would be to put while(){
} around your code... or some other loop     

Share this post


Link to post
Share on other sites
because theres no such thing as ''loop''
i suggest you read some primer tutorials on the net or get a book.

-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

Share this post


Link to post
Share on other sites
The, probably better, solution, as others have insinuated at is to wrap the code you want to execute more than once into its own function, then call that function as many times you want.

As foor "loop undefined", I guess you tried Beowulf_ as it was. loop is a bool type variable (which of course must be defined) which is tested to see if the block shall be executed or not. If you don't want the block to be skipped, you need to set it to true before the loop. You would also need a way to set it to false to exit the loop.

EDIT: Btw, I think someone needs to take a trip to the book store (hint, hint)




[edited by - CWizard on November 30, 2002 7:23:49 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!