程序里的注释是很重要的。它们可以用自然语言告诉你某段代码的功能是什么。在你想要临时移除一段代码时,你还可以用注解的方式将这段代码临时禁用。接下来的练习将让你学会注释:EX2
01 D String S 51A
02 D Wait S 1A
03 C* A comment, this is so you can read your program later.
04 C* Anything after the * is ignored by RPGLE fixed format
05 C Eval String = 'Hello World!'
06 C String Dsply this a comment
07 C*
08 C* You can also use a comment to "disable" or comment out a piece of code:
09 C* Eval String = 'This won''t run'
10 C Eval String = 'This will run'
11 C String Dsply Wait
12 C*
13 C Eval *inlr = *on
14 C Return
EX2F
01 D String S 51A
02 D Wait S 1A
03 /free
04 // A comment, this is so you can read your program later.
05 // Anything after the * is ignored by RPGLE fixed format
06 String = 'Hello World!';
07 dsply String; // this a comment
08 // You can also use a comment to "disable" or comment out a piece of code:
09 //String = 'This won''t run';
10 String = 'This will run';
11 dsply String '' wait;
12
13 *inlr = *on;
14 return;
15
16 /end-free
程序的编译和运行参考练习1的介绍。
1.
弄清楚“*”或“//”的作用。
2.
打开你的文件,从后往前逐行检查。从最后一行开始,倒着逐个单词单词检查回去。
3.
有没有发现什么错误呢?有的话就改正过来。
4.
朗读你写的习题,把每个字符都读出来。有没有发现更多的错误呢?有的话也一样改正过来。
阅读(1029) | 评论(0) | 转发(0) |