数据分析师2017-09-30 23:22:17
Switch must be assigned an initial value, and the value matches each case value. What does "assign an initial value" mean in this sentence? -PHP Chinese website Q&A-Switch must be assigned an initial value, and the value matches each case value. What does "assign an initial value" mean in this sentence? -PHP Chinese website Q&A
Please watch and learn.
迷茫2016-12-21 10:46:39
注意语法:x 就是需要赋初始值的变量,只有该值被赋值后,后面的case代码块才能根据其值执行相应的代码内容
switch(x){
case x值1:
执行的代码块1;
break;
case x值2:
执行的代码块2;
break;
}