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

feature idea: switch #15

Open
JustPlayerDE opened this issue Jun 11, 2020 · 2 comments
Open

feature idea: switch #15

JustPlayerDE opened this issue Jun 11, 2020 · 2 comments
Labels
enhancement New feature or request
Projects

Comments

@JustPlayerDE
Copy link

JustPlayerDE commented Jun 11, 2020

switch:

something like a switch statement

example:

switch(Value)
 case "a": -- Only when the Value is "a"
   print("A")
 end,
 case "b":
   print("B")
 end
end

example 2:

switch(Value)
    case("a")
        print("A")
        break

    case(2)
        print("B")
        break

    default
        print("Default case")
end

This may be hard to implement tho

@JustPlayerDE JustPlayerDE changed the title feature: switch feature idea: switch Jun 11, 2020
@NoSharp
Copy link
Member

NoSharp commented Jun 11, 2020

I'm absolutely implementing it, however I'd like to propose a change. Adding the end keyword to each case/default. so it'd be

switch(Value)
    case("a")
        print("A")
        break
    end

    case(2)
        print("B")
        break
    end
    default
        print("Default case")
    end
end

@JustPlayerDE
Copy link
Author

yeah this is also more readable :)
(and maybe even more easier to implement)

@TomDotBat TomDotBat added the enhancement New feature or request label Jun 11, 2020
@FoksVHox FoksVHox added this to To do in v1.2 Jun 12, 2020
@LuaPlusPlus LuaPlusPlus deleted a comment from garryspins May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
v1.2
  
To do
Development

No branches or pull requests

3 participants