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

It would be nice to have {#switch}{:case}{/switch} #9257

Closed
Gorbulev-Sergey opened this issue Sep 24, 2023 · 3 comments
Closed

It would be nice to have {#switch}{:case}{/switch} #9257

Gorbulev-Sergey opened this issue Sep 24, 2023 · 3 comments

Comments

@Gorbulev-Sergey
Copy link

Describe the problem

Sometimes it is necessary to use "switch/case", because with a large monotonous list, "if/else if" overloads the code.

Describe the proposed solution

I would like to have something like:

{#switch variable}
    {:case "first"}
      ... something first ...
    {:case "second"}
      ... something second ...
    {:default}
      ... other ...
{/switch}

Alternatives considered

Thanks guys!

Importance

would make my life easier

@brunnerh
Copy link
Member

brunnerh commented Sep 24, 2023

RFC: sveltejs/rfcs#49

@Conduitry
Copy link
Member

Yup, this has come up several times in the past. It's stalled due to lack of agreement on what the syntax would look like.

@Conduitry Conduitry closed this as not planned Won't fix, can't repro, duplicate, stale Sep 24, 2023
@Gorbulev-Sergey
Copy link
Author

Thanks guys, I realized that this is an old topic.

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

No branches or pull requests

3 participants