Sign in to follow this  
NavySeal5

switch fall through possible?

3 posts in this topic

in some languages you have to do the break; command after a switch case because otherwise it would do the next one aswell 

here an example of what i mean

 

Spoiler

switch (_test) do {

    case 5 : {//do stuff};

    case 4 : {//do more stuff};

    break;

    case 3 : {//do even more stuff};

    break;

    case 2: {//do a lot of stuff};

};

 

 

so if in this example _test would be 5  it would execute the code from case 5 and 4 .

while when it would be 4 , 3  or 2  it would only execute the corresponding code because the of the break;

Edited by NavySeal5

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.