在條件事選擇的時候,通常可以用幾種選擇性結構進行判斷
在php中 if 條件式是這麼下的
if (a!=0){
做什麼事;}else{
做另一件事;
}
如此一來,完成一個選擇性的結構
在delphi中,法語有一些些的不同,在if..than…else的結構中,不能放;(if條件句結束),如果要放;,只能加在begin…end中
下面是做按鈕的開關sample
If Edit1.Text=” Then
Button1.Enable:=false
Else
Button1.Enable:=true; <—最後要加分號做結束
多內容的If…Then…Else語法
If Edit1.Text=” Then
begin
Button1.Enable:=false;
Button2.Enable:=false;
Button3.Enable:=false;
end <—第1個End 不加 ; 最後一個End 才加;
Else
begin
Button1.Enable:=true;
Button2.Enable:=true;
Button3.Enable:=true;
end
;
隨機文章
- OLPC-微軟為100美元筆記本開發定製版WinXP (2007-11-03)
- 用虛擬機架FTP的解決方案 (2016-08-03)
- PhotoPrism + MariaDB Docker Compose (2024-10-09)
- 個人資料保護研討會心得 (2011-06-29)
- 劉兆玄終於下台了 (2009-09-07)








