Contents of the Switch statement.
switch语句的内容。
A switch statement should have the following form.
switch语句应如以下格式。
Use cURL, as shown in Listing 9, to verify that the switch statement is working correctly.
如清单9所示,使用cURL来验证s witch语句运行正常。
We resorted to using a simple switch statement in order to define the class value with more control.
我们使用一个简单的switch语句,以更强的控制能力定义class值。
If the vendor name is recognized, the switch statement follows the expected pattern for that vendor.
如果商家名称被认可,switch语句就会遵照该商家的期望模式。
The bulk of the work is done by the 250 line switch statement that makes up the EmitFragment function.
这些工作由EmitFragment函数完成,其中包含了大约250行的switch语句。
This is part of a large switch statement that enumerates each method; this will become important later.
这是一个列举每种方法的庞大switch语句中的一部分,这些内容待会就变得很重要。
In Listing 6, the switch statement determines the value to use based on the first part of the URL path.
在清单6中,switch语句根据URL路径的第一部分决定要使用的值。
The OMG CORBA specification describes the IDL union as a cross between a C union and a switch statement.
OMGCORBA规范将IDL联合描述成C 联合类型和switch语句的混合物。
The code fragment in Figure 1 shows the exact path the application took when executing the switch statement on line 111.
图1中的代码段显示了第111行执行交换陈述时所应用的准确路径。
We experimented with different uses for pattern matching, a powerful improvement on the familiar case-switch statement.
我们实验了不同的模式匹配,作为对我们熟悉的case-switch 指令的一种强大增强。
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的实例检查套接字是否绑定到端口。
I get the int and store it in n. The switch statement takes inside its parenthesis an int or a char or some primitive type.
我得到一个整数并把它存储,到n中,switch语句的圆括号里可以是一个整数,或者一个字符或其他的基本类型。
This method used a PHP switch statement that sets the value for the class attribute based on the first argument in the URL.
这种方法使用一个php分支语句,根据URL中的第一个参数设置class属性值。
For example, a programmer might include the assertion that you should never reach the default condition in a switch statement.
例如,程序员可能会在程序中包含断言,使您永远也不会到达switch语句中的default条件。
Then it uses the all-too-familiar switch statement to determine the error level and craft an error message appropriate to that level.
然后,它使用再熟悉不过的开关语句来决定错误等级并相应打造与该等级相适应的错误消息。
Not all enum constants covered on switch Missing enumerations on a switch statement, meaning that you may miss some enumerated options.
Notall enum constantscoveredonswitch switch语句缺少枚举项意味着您可能遗漏一些枚举选项。
Both blocks of code evaluate an int value using a switch statement that results in a human-readable string value printed to the console.
这两个代码块都会使用switch语句计算int值,从而得到输出到控制台的供人阅读的字符串值。
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情况还是太狭窄了)。
Then, it USES a state machine (a switch statement, that is) to determine whether an incoming character represents the end of a partition.
然后,它使用一个状态机(即s witch语句)来决定引入的字符是否代表分区的末端。
One of the primary reasons for this is primitives and instructions are wrapped in a huge switch statement in C, which is a pain to maintain by hand.
这样做的主要原因是基础实现和指令在C语言的声明中可以包装为一个大的switch表达式,如果使用手工的方式来完成无疑将会是非常痛苦的。
Extending the reach of the switch statement, not only to strings but also to other types, has been the subject of repeated enhancement requests over the years.
不仅是把switch语句的范围扩展到字符串上,而且要扩展到其他类型上,这已经是多年来一直反复在提交的一个增强性请求了。
First, you parse the ID from the XML structure returned from PHP, then you use a switch statement to direct the error to the appropriate message or associated code.
首先,从XML结构(从php返回的)中解析id,然后使用一个转换语句直接指向消息或者相关代码。
The resulting code is a beautiful example of a tiny domain-specific language within Rails that extends Ruby to make a kind of switch statement. Here's how it works.
生成的代码是Rails中小型的特定于域的语句的优美示例,它扩展Ruby以构造一种switch语句。
Ceylon also ensures (at compile time) that the switch statement contains an exhaustive list of instance tests or, at a minimum, an else clause to provide complete coverage.
Ceylon还确认(在编译时)switch语句包含详尽的实例测试列表,至少包含else子句,从而提供完整的覆盖范围。
Likewise, you might want to add assertions to else conditions in if blocks, where conditions are assumed, or to default cases of a switch statement, which should never be reached.
同样,您可能希望向if块中的else条件添加断言,这里已经设置了该条件,或者向switch语句中的缺省情况中添加断言,使缺省情况永远不可能到达。
The main method USES an enhanced for loop to iterate through the different primitives and a simple switch statement on the current instance to set the size value of each primitive.
main方法使用增强的for循环来迭代通过不同的原语,并在当前实例上使用一个简单的switch语句来设置每个原语的大小值。
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跳入到声明表达式中。
Tiger has conveniently added enum support to the good old switch statement, so it's easy-to-use and fits right in with what you already know. Listing 6 shows you how to pull this off
Tiger能够很方便地把枚举支持添加到过去的好东西switch语句上,所以它很容易使用,而且适合您已知的内容。
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).
其他有用的经验法则:一个函数如果有判断或循环语句通常是没效率的。(除非在通常的情况下循环语句或判断语句不会执行)。
应用推荐