Skip to content

Feature idea: {#switch} #6304

@Henodude

Description

@Henodude

Is your feature request related to a problem? Please describe.
In svelte, if you want each value of a number to do something different, you have to have something like this:

{#if value === 1}
one
{:else if value === 2}
two
{:else if value === 3}
three
{:else}
some other number
{/if}

However, this can be tedious.

Describe the solution you'd like
I want a {#switch} block. You would use it like this:

{#switch value}
{:case 1}
one
{:case 2}
two
{:case 3}
three
{:default}
some other number
{/switch}

How important is this feature to you?
It's not very important. It's just a more convenient syntax to do things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions