Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing documentation for labels #770

Open
melex750 opened this issue Apr 27, 2016 · 8 comments · May be fixed by colobot/colobot-data#128
Open

Missing documentation for labels #770

melex750 opened this issue Apr 27, 2016 · 8 comments · May be fixed by colobot/colobot-data#128
Assignees

Comments

@melex750
Copy link
Contributor

Also works with continue;

extern void object::New()
{
    bool exit = false;

    loop1: do {
        loop2: while (true) {
            if (exit) break loop1;

            loop3: for (;true;) {
                loop4: while (true) {
                    exit = true;
                    continue loop2;
                }
            }
        }
    } while (true);
    message("done");
}
@tomaszkax86
Copy link
Contributor

How is this an issue? It's already implemented and working, just not documented in CBot manual I think.

@MrSimbax
Copy link
Contributor

@tomangelo2
Copy link
Member

http://i.imgur.com/h4VRsle.png
http://i.imgur.com/GgqzbZ4.png
There is problem with tabs, but rest is good?

@MrSimbax
Copy link
Contributor

I refuse to accept the existance of labels and I am not going to document them in any way, what is more, I strongly suggest to remove them from CBOT before some poor soul thinks it is a good idea to use them. The last time someone used labels a satellite crashed.

@tomaszkax86
Copy link
Contributor

@MrSimbax Those are Java-style labels which don't work like C labels. Their purpose is similar but they are used differently. In CBot you can only label loop statements and you can only use them with break and continue inside that loop block in order to directly break multiple levels of loop nesting. You can't use them to jump between different sections of code. This is better and safer than C equivalent because it doesn't break program structure and flow. I used it in some of my programs. There is no reason to remove this feature and I suggest we keep it.

@MrSimbax
Copy link
Contributor

Ooooooooooh, ok then, sorry for my ignorance.

@tomangelo2
Copy link
Member

Okay, got these tabs on their places, so can I push it in such form, or there is something I should change before?

@hexagonrecursion
Copy link
Contributor

I think this should be renamed to "Missing documentation for labels" because the feature appears to be implemented

@melex750 melex750 changed the title Use a label with "break;" to exit nested loops. Missing documentation for labels Aug 28, 2024
@hexagonrecursion hexagonrecursion self-assigned this Dec 27, 2024
@hexagonrecursion hexagonrecursion linked a pull request Dec 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants