1

嗨,我正在制作屏幕保护程序,我需要知道我的代码有什么问题..

GraphicsWindow.title="Screen Saver" 
GraphicsWindow.Width=500 
GraphicsWindow.Height=500

For i=1 To 
Colour = GraphicsWindow.GetRandomColor() 
GraphicsWindow.BrushColor=Colour
XCoord = Math.GetRandomNumber(1200) 
YCoord = Math.GetRandomNumber(1200)
width=math.GetRandomNumber (300)
GraphicsWindow.Fillellipse(XCoord,YCoord,width,width) 
Program.Delay(200) 

EndFor
ContinueForEver = "Yes" 
While ContinueForEver = "Yes"
EndWhile

我应该使用[for i=? to ?] 做一个无限循环,我应该使用 While endwhile 来做 continue 事情。所以基本上我应该制作一个永远生成圆圈的屏幕保护程序..谢谢

*感谢你们对我的帮助

4

1 回答 1

1

像这样的东西?

GraphicsWindow.title="Screen Saver" 
GraphicsWindow.Width=500 
GraphicsWindow.Height=500

While 1 = 1 
  Colour = GraphicsWindow.GetRandomColor() 
GraphicsWindow.BrushColor=Colour
XCoord = Math.GetRandomNumber(1200) 
YCoord = Math.GetRandomNumber(1200)
width=math.GetRandomNumber (300)
GraphicsWindow.Fillellipse(XCoord,YCoord,width,width) 
Program.Delay(200) 
EndWhile

你非常亲近。但是你不能有一个没有这样的数字的 for 循环:

For i = 1 to

你必须有一个结束号码:

For i = 1 to 10 '<-- the loop will run 10 times

只要输入为真,while 语句就会运行。所以在这种情况下,只要 1 = 1 循环就会继续(永远)

这有帮助吗?:D

于 2014-11-06T05:03:19.007 回答