判断:if else 与 switch
与 and
或 or
非 not(条件)
其中1个成立,则为真, 其他情况均为假 xor
dev_open_window(0, 0, 512, 512, 'black', WindowHandle)
i:=-1
if (i=0)
disp_message (WindowHandle, '真不错', 'q',512/2, 512/2, 'black', 'true')
elseif(i>0)
disp_message (WindowHandle, '还可以', 'w', 512/2, 512/2, 'black', 'true')
else
disp_message (WindowHandle, '有点难受', 'e', 512/2, 512/2, 'black', 'true')
endif
i:=1
switch(i)
case 1:
disp_message (WindowHandle, '真不错', 'q',512/2, 512/2, 'black', 'true')
break
case 2:
disp_message (WindowHandle, '还可以', 'w',512/2, 512/2, 'black', 'true')
break
default:
disp_message (WindowHandle, '有点难受', 'e', 512/2, 512/2, 'black', 'true')
endswitch
循环:while 与 for
i:=1
while (i<100)
disp_message (WindowHandle, '真不错'+i, 'q',512/2+i*2, 512/2+1*2, 'black', 'true')
i:=i+10
endwhile
for i := 1 to 5 by 1
disp_message (WindowHandle, '真不错'+i, 'q',512/2+i*20, 512/2+1*20, 'black', 'true')
endfor
综合
for Index := 1 to 5 by 1
if (Index==1)
disp_message (WindowHandle, '第0次', 'q',512/2, 512/2, 'black', 'true')
elseif(Index==2)
continue
endif
disp_message (WindowHandle, '第'+ Index + '次', 'q',0+Index*20, 0+Index*20, 'black', 'true')
endfor