Although it isn't the optimal solution, multiple elif statements can be used to mimic the switch case statement present in some other languages.
尽管它不是最优的解决方案,但是多个elif语句可以用于模拟其他一些语言中的switch case语句。
Jumping into a statement expression with goto or using a switch statement outside the statement expression with a case or default label inside the statement expression is not permitted.
不允许使用switch语句或是goto跳入到声明表达式中。
Within the switch statement of the tcp_usrreq function, the case for PRU_LISTEN checks if the socket is bound to the port.
在tcp_usrreq函数的切换语句中,PRU_LISTEN的实例检查套接字是否绑定到端口。
We experimented with different uses for pattern matching, a powerful improvement on the familiar case-switch statement.
我们实验了不同的模式匹配,作为对我们熟悉的case-switch 指令的一种强大增强。
A little trick of using a dictionary as a switch statement is used here (although the otherwise case remains too narrow in the example).
在这里我们使用了一个技巧,就是用一个字典作为一个switch语句(尽管示例中的otherwise情况还是太狭窄了)。
Another useful rule of thumb: it's typically not cost effective to inline functions with loops or switch statements (unless, in the common case, the loop or switch statement is never executed).
其他有用的经验法则:一个函数如果有判断或循环语句通常是没效率的。(除非在通常的情况下循环语句或判断语句不会执行)。
Another useful rule of thumb: it's typically not cost effective to inline functions with loops or switch statements (unless, in the common case, the loop or switch statement is never executed).
其他有用的经验法则:一个函数如果有判断或循环语句通常是没效率的。(除非在通常的情况下循环语句或判断语句不会执行)。
应用推荐