Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Case goto's? #174

Closed
Arthurdw opened this issue Apr 5, 2021 · 1 comment
Closed

Case goto's? #174

Arthurdw opened this issue Apr 5, 2021 · 1 comment

Comments

@Arthurdw
Copy link

Arthurdw commented Apr 5, 2021

Hey there.
First of all, I want to say that this is absolutely amazing, but I was wondering how case goto's are planned?

Like what can be done in c#, ts etc

For example in c#:

switch (value) {
    case myEnum.A:
    case myEnum.B:
        // ...
        break;
    case myEnum.C:
        // ...
        break;
    case myEnum.D:
        // ...
        goto case myEnum.C;
    default:
        // ...
        break;
};
@Arthurdw Arthurdw changed the title Case fallthrough & goto's? Case goto's? Apr 5, 2021
@thautwarm
Copy link

C# just reports an error when you jump to somewhere with incorrect scope(required variable binding can be missing), but in Python this sort of problems will be more difficult to control.
And if you do have some common code block to execute after some cases, it will be more readable to call a function.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants