Delphi-continue有用吗?

  2007-07-12  字体:[

procedure TDemo33Form.btnStringClick(Sender: TObject);var S:String; Ch:Char;begin S:=''; for Ch:='a' to 'z' do begin if odd(ord(ch)) then continue; S:=S+Ch; //连接一个字符到S end; lblOutput.Caption:='ASCII码end;end. 这里的continue我去掉不也行吗?`

字串8

网友解答:

if not odd(ord(ch)) then S:=S+Ch; 字串6

网友解答:

呵~~,我顶! 字串8

网友解答:

复杂判断时,可以少些一些 else begin end ...

字串2

网友解答:

ly_liuyang,你的意思是continue没有什么意思吗?

字串8

网友解答:

二楼,我支持你!!我顶!!!! 字串6

网友解答:

我试过楼主的程序没任何问题,虽然可以不用continue。你应该是编译不通过吧?要留意看是报什么错,我发现你有一个end后面是全角分号....

字串7

网友解答:

continue写和不写是不是没用?

字串7

网友解答:

continue就不执行循环下面的代码了的,直接开始下次循环的 if odd(ord(ch)) then continue; S:=S+Ch; //连接一个字符到S和if not odd(ord(ch)) then S:=S+Ch;这两个等效的 字串6

网友解答:

支持樓上

字串7

网友解答:

总算有一个明白我的问题,谢谢大家

字串9

网友解答:


上一篇:比如1,4,4,这3个数为什么有C(3,2)种排列
下一篇:请问哪家医院治疗肝病权威?
  •    网站首页 -  网站导航 -  联系方法 -  网站地图 -  客户服务 -  相关法律 - 问答网 -  广告服务 -  帮助中心