在條件事選擇的時候,通常可以用幾種選擇性結構進行判斷
在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
;
隨機文章
- 不專業的詐騙集團 (2008-09-28)
- 有沒有搞錯啊!MSNBot1分鐘內強迫存取我的VPS 30次 (2010-11-24)
- OCZ SSD 掛點 (2012-04-06)
- 每個男人心中都有一個超級賽亞人 (2011-06-26)
- [chatGPT 測試]寫一隻python使用selenium 4.x版 搭配 chromdrivermanager 操作Chrome 打開 Gmail網站 輸入帳號密碼 進行登入 (2023-12-14)








