内容提要1909大T条件语句OTONG循环语句2006-3-
2006-3- 10 2 内容提要 ❖条件语句 ❖循环语句
if_else语句TOTONG1)if(表达式)语句if (a>b)out1=int1;2006-3-
2006-3- 10 3 if_else语句 ❖1)if(表达式)语句 ▪ if (a>b) ▪ out1 = int1;
if_else语句1909TOTONG2)if(表达式)语句1if (a>b)elseout = int1;语句2elseout = int2;2006-3-
2006-3- 10 4 if_else语句 2) if (表达式) 语句1 else 语句2 if (a>b) out = int1; else out = int2;
if_else语句大TTONG3)if(表达式1)if(a>b)语句1;out = int1;else if(a==b)elseif(表达式2)语句2out=int2;elseout=int3;elseif(表达式3)语句32006-3-
2006-3- 10 5 if_else语句 3)if(表达式1) 语句1; else if(表达式2) 语句2 ; else if(表达式3) 语句3 ; if(a>b) out = int1; else if(a==b) out=int2; else out=int3;
if_else语句-ALIST表达式为关系运算或逻辑运算OTONG对表达式进行运算,若为O,X,z,按“假”处理;若为1则按“真”处理分号,else和if配对出现心if和else后面可以包含一个或多个内嵌的操作语句begin...end心允许一定形式的表达式简写方式if(a)=>if(a==1)if(a)=>if(a==0)2006-3-
2006-3- 10 6 if_else语句 ❖表达式为关系运算或逻辑运算 ▪ 对表达式进行运算,若为0,x,z,按“假”处理;若 为1则按“真”处理 ❖分号,else和if配对出现 ❖if和else后面可以包含一个或多个内嵌的操作语 句 ▪ begin . end ❖允许一定形式的表达式简写方式 ▪ if(a) => if (a==1) ▪ if(!a) => if (a==0)