首页 > 其他 > 详细

(三) 语句

时间:2014-02-19 06:40:13      阅读:318      评论:0      收藏:0      [点我收藏+]

1、if语句

     if 条件表达式 then

语句块

     else

语句块

     endif;

或者是

    if 条件表达式 then

语句块

   elseif 条件表达式

语句块

    ....

   endif; 

例如:

 bubuko.com,布布扣

 2、if goto语句

if 条件表达式 goto 标号;

例如:

 bubuko.com,布布扣

3、switch .. endswitch;

  switch (表达式)

case 常量1: 语句1

  case 常量2: 语句2

…… 

default: 语句n+1 

  endswitch;

例如:

bubuko.com,布布扣

4、 while语句

 while (表达式)

语句块

endwhile;

注:不能在循环中定义标号 

例如: 

 

bubuko.com,布布扣

 

5、 repeat .. until语句

repeat

语句块

until (表达式); 

注:不能在循环中定义标号

例如:

bubuko.com,布布扣


6、 for .. endfor语句

 for X = A to B step C

语句块

endfor;

注:X为循环变量,A为初值,B为变量终值,C为单位步长。这里的to也可以变量成downto,如果省略step,则增量自动为1

注:不能在循环中定义标号

 

例如:

bubuko.com,布布扣 

(三) 语句

原文:http://www.cnblogs.com/wang-can/p/3554458.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!