让小车红灯停,绿灯行出现以下情况不能解决:7 ^6 g, m; I( M# |- s
1)is9 b4 u5 z( Z9 t
do8 }% K( p& P, R5 f! v1 O
if light="green"
' n* K" t% |/ M: i. A2 v then @.stopped:=false;* ~; M6 r9 G9 Y+ f
else
' p: m; E2 z q8 l4 h @.stopped:=true;
; O' s$ V* s1 ]' l" }5 e end;
7 K. g X4 T: D% X% Q) uend;' L# n$ N5 n8 B# ^' u
3 u* V) o, o9 y' s9 E* Y" o; A, d用if else then,只会停止,不能运动,停了以后Method 不会再被调;
5 P2 L. d! F8 T2 f" i5 L8 @2)is
) ~8 l# Z" `5 d' \do2 V5 K3 h! J/ H9 [6 q
if light="green"; _$ c* E; ~/ X
then @.stopped:=false;" g1 w0 Y, K2 ?+ h4 c
else
; ^, Y' y2 t2 j6 I; Q- ]+ j& } @.stopped:=true;% |6 g& C% z" W
end;# [; K, L/ c' p1 X: n) t B: c# o
@.move;--加了这个以后则不管红绿灯都是一直运动的,
! R( R% M c( E- W1 Mend;) H! J$ U, l( O1 c. b
3)用ispect-when-when-else,出现同样的情况
. ?: i9 C5 q# c% n求高手解决。 |