因为我无法用你的例子编程,但条款写成程序,是这样的

本帖于 2015-03-09 15:12:47 时间, 由普通用户 慧惠 编辑

If [red light]
     Then “stop at a marked limit line” (A,B);
If [an indication to proceed is shown]
     Then
          Go(A);
     Exception
          If [pedestrians lawfully within an adjacent crosswalk]
               Then
                   Yield (B);
          End If;
End If;

If [green light]
     Then
          If [pedestrians lawfully within an adjacent crosswalk]
          Then
               Yield(B);
          Else
               Go (A);
          End if;
End If;


在我看来,A和B不是平行的关系,所以没有dead loop,B作为A的一个exception, 它依旧可以独立存在,就是第二个if

如果程序走到exception而你不走,就用B罚。


所有跟帖: 

最后一把 -原野青蛙- 给 原野青蛙 发送悄悄话 原野青蛙 的博客首页 (1187 bytes) () 03/09/2015 postreply 15:33:15

你就是错在这里,B不是else, A的else是go,B是else 的exception -慧惠- 给 慧惠 发送悄悄话 慧惠 的博客首页 (44 bytes) () 03/09/2015 postreply 15:39:46

青蛙就是没有理解英文的意思才造成他写成那样的程序,还理直气壮, -水中捞月- 给 水中捞月 发送悄悄话 水中捞月 的博客首页 (27 bytes) () 03/09/2015 postreply 16:05:15

但第一个条件,程序走不通,所以我估计,正确理解应该是这样吧 -慧惠- 给 慧惠 发送悄悄话 慧惠 的博客首页 (268 bytes) () 03/09/2015 postreply 16:07:49

把俺上面的解释看一遍,再编。 -水中捞月- 给 水中捞月 发送悄悄话 水中捞月 的博客首页 (54 bytes) () 03/09/2015 postreply 16:18:51

你上面哪个解释最好?copy/paste过来好吧? -慧惠- 给 慧惠 发送悄悄话 慧惠 的博客首页 (0 bytes) () 03/09/2015 postreply 16:27:44

提示一下: -水中捞月- 给 水中捞月 发送悄悄话 水中捞月 的博客首页 (116 bytes) () 03/09/2015 postreply 16:39:14

这个解释: -水中捞月- 给 水中捞月 发送悄悄话 水中捞月 的博客首页 (206 bytes) () 03/09/2015 postreply 16:42:56

非程序员改写一把,请指教: -水中捞月- 给 水中捞月 发送悄悄话 水中捞月 的博客首页 (858 bytes) () 03/09/2015 postreply 16:52:44

你那个提示是对的,这样一个条件下面,就只会有一个指令了 -慧惠- 给 慧惠 发送悄悄话 慧惠 的博客首页 (693 bytes) () 03/09/2015 postreply 17:24:45

算了,超出俺的理解范围了,谢谢你的合作。既然已打包,就别再劳神了。 -水中捞月- 给 水中捞月 发送悄悄话 水中捞月 的博客首页 (0 bytes) () 03/09/2015 postreply 17:33:12

嗯,打包的东西,我也懒得进。不过我明白了,否则堵那儿非把我憋死不可。 -慧惠- 给 慧惠 发送悄悄话 慧惠 的博客首页 (0 bytes) () 03/09/2015 postreply 17:37:05

请您先登陆,再发跟帖!