zl程序教程

您现在的位置是:首页 >  前端

当前栏目

你这样用过DO循环吗详解编程语言

循环编程语言 详解 这样 Do 用过
2023-06-13 09:11:51 时间

DATA: BEGIN OF text,
 word1(4) TYPE c VALUE  This ,
 word2(4) TYPE c VALUE  is ,
 word3(4) TYPE c VALUE  a ,
 word4(4) TYPE c VALUE  loop ,
 END OF text.

DATA: string1(4) TYPE c, string2(4) TYPE c.

DO 4 TIMES VARYING string1 FROM text-word1 NEXT text-word2.
 WRITE string1.
 IF string1 =  a .
 string1 =  an .
 ENDIF.
ENDDO.

SKIP.
write:  text-word3 =   , text-word3.
skip.

DO 3 TIMES VARYING string1 FROM text-word1 NEXT text-word2
 VARYING string2 FROM text-word2 NEXT text-word3.
 WRITE: string1, string2.
ENDDO.

说明:

需要说明的是,对于string1的值更改,实际上是修改了text中组件的值,这里的string1和string2引用了text中组件的值

19662.html

c