在條件事選擇的時候,通常可以用幾種選擇性結構進行判斷
在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
;
隨機文章
- 被ECC記憶體打敗的我 (2011-01-09)
- FCKeditor PHP調用筆記 (2009-05-04)
- 最後 放棄在家和在公司使用 adguard Home (2020-12-03)
- VBoxClient: the VirtualBox kernel service is not running. Exiting. (2016-02-15)
- 看到新銳光的網站,我笑了 (2016-07-26)