default statement的意思|示意
[计] 缺省语句
default statement的用法详解
default statement(缺省语句)是编程语言中的一种控制结构,也叫做默认语句。它是switch语句的一部分,根据条件执行一些操作语句。
default statement主要用来在switch语句中处理条件表达式没有匹配到的情况。当switch语句的条件表达式的值没有和case子句的条件表达式的值相同时,就会执行default子句。
default statement的用法也很简单,只需要在switch语句最后写入defalut语句即可,如:
switch (ch)
{
case 'A':
// execute statement;
break;
case 'B':
// execute statement;
break;
default:
// execute default statement;
break;
}
简而言之,default statement就是提供一种条件语句没有被匹配到时的情况处理,主要用来处理switch语句。
default statement相关短语
1、 default format statement 内定格式叙述,翻译,约定格式语句英语
2、 Default Liability Statement 违约责任说明
3、 Statement of Default 违约声明书
default statement相关例句
You can use the default statement with enums and switches, just as you would expect. Listing 7 illustrates this usage
正如您所期待的,在使用枚举和 switch 时,您可以使用 default 语句。
In these cases, having some sort of general purpose default statement is very important.
在这种情况下,存在某种能够通用的default语句是非常重要的。
Consider the code above and realize that any enumerated value not specifically processed by a case statement is instead processed by the default statement.
研究以上代码可以看出,任何没有被case语句处理的枚举值都会被default语句处理。