Ruby Shoes GUI ToolKit 中的 While 循环
我现在才使用鞋子几天,所以也许我错过了一些东西。 我给我儿子写了一个小程序来帮助他学习乘法表。 当他答对十个时,他就完成了。 我似乎无法使用 SHOES 正确地进行 while 循环。 请给我看一段声明。 当我尝试时; 它要么清除我的流程和堆栈语句,要么导致 Shoe 崩溃。
提前致谢。 山姆
I have only been using Shoes for a few days now so maybe I am missing something. I wrote my son an little program to help him learn his multiplication tables. When he gets ten correct he's done. I can not seem to get the while loop right using SHOES.
Would some please show me a while statement. When I try; it either wipes out my flow and stack statements or Shoe crashes.
thanks in advance.
Sam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道你是如何使用
while
循环的。 您很可能尝试通过while
循环每次迭代重新创建堆栈,这是一个坏主意。 立即浮现在脑海中的两个解决方案是处理按钮单击的逻辑并连续跟踪正确的数字,如下所示:或者,我认为更有趣的解决方案是使用
url 和<代码>访问:
I don't know how you're using a
while
loop. Most likely you're trying to recreate the stack each iteration through thewhile
loop, which is a bad idea. The two solutions that spring immediately to mind are to handle the logic on a button click and keep track of the number correct in a row, like this:Or, the solution which I think is much more interesting, using
url
andvisit
: