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

no need to use break #635

Open
Mineocat opened this issue Aug 15, 2019 · 2 comments
Open

no need to use break #635

Mineocat opened this issue Aug 15, 2019 · 2 comments

Comments

@Mineocat
Copy link

Challenge Selecting from many options with Switch Statements has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

function myTest(val) {
  var answer = "";
  // 请把你的代码写在这条注释以下
  
  switch(val){
    case 1:
      return "alpha";
    case 2:
      return "beta";
    case 3:
      return "gamma";
    case 4:
      return "delta";
  }
  
  // 请把你的代码写在这条注释以上
  return answer;  
}

// 你可以修改这一行来测试你的代码
myTest(1);
@Mineocat
Copy link
Author

为什么要强制使用break呢

@dong-hx
Copy link

dong-hx commented Aug 29, 2019

为什么要强制使用break呢

因为不使用的话,程序会继续向后接着逐步执行

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

2 participants