让小车红灯停,绿灯行出现以下情况不能解决: C- M2 Z7 H* U" q9 t) b u
1)is5 ^9 Q! Q A, |( `1 L8 }) q1 J
do
) X8 h" ?5 i! s0 p3 r" K P if light="green"* o$ m8 ` f2 G$ C& Y
then @.stopped:=false;" Y5 _8 o1 l% T* B
else
7 U1 Y& {9 B4 _; ^2 E @.stopped:=true;9 U* h/ S B4 l$ l
end;
; \. z" p: ], t' o" U; h8 W6 Send;
7 } B9 ^2 K1 O0 w# B! l+ w+ m# ?( A' \: A8 [
用if else then,只会停止,不能运动,停了以后Method 不会再被调;" A% \# M0 k; L6 I3 t
2)is
1 v2 J9 ~: x; s% j& ado0 D- t0 A, N; W# C% {/ e" g% n
if light="green"- T$ a7 V/ k1 Z9 y; ]
then @.stopped:=false;0 l3 g1 ^# |9 G8 \
else8 J3 h0 R( d3 H( n6 M
@.stopped:=true;
7 V$ e* }! y3 n4 t8 q2 t end;' B6 r$ v' C2 `- N& o( v6 r6 S
@.move;--加了这个以后则不管红绿灯都是一直运动的,
6 b( g/ y( ~1 k; y) Xend;' l k/ V. Q( R( y0 s$ G" u
3)用ispect-when-when-else,出现同样的情况
! c5 Z# c L/ f! g( I! X9 N8 N6 g求高手解决。 |