VB试题 8.请写出几种常用选择结构的语句格式?

2025-02-26 21:08:01
推荐回答(1个)
回答1:

1、 if …… then分支结构
if condition then 单行形式
或者:
if condition then statements
end if 2、 if …… then …… else 分支结构
if condition then else statement 单行形式
或者:
if condition then statements1
else
statements2
end if
3、switch语句格式  Switch(expr-1, value-1[, expr-2, value-2 _ [, expr-n,value-n]])   Switch 函数的语法有以下几个部分: 部分描述expr必要参数。要加以计算的 Variant表达式。value必要参数。如果相关的表达式为 True,则返回此部分的数值或表达式。area = Switch(continent = "Asia", "China", continent _   = "Europe", "Russia", continent = "America", "the U.S.A.")