1、IF.. THEN if 1=1 then begin //这里写执行语句 end; 2、IF..ELSE if 1=1 then begin ... end //记住这里不能加分号。 else begin ... end; //这里需要加分号 3、IF...ELSE IF.. if 1=1 then begin ... end //记住这里不能加分号。 else IF 1=2 THEN begin ... end; //这里...
function GetString(a :string):string;beginif a = '' thenresult := ''elseresult := a;end;调用:vara,c :string;begina := '1111';c := 'mm' + GetString(a);end;if a='' then beginc:='';endelse beginc:=a;end;if a='' thenc:=''elsec:=a;if a='' thenc:='...
对if-then型语句,仅当条件满足时,语句才执行;对if-then-else型,if语句在两条语句中选择一条执行。条件用布尔表达式建立,句子中的条件部分可以是一系列条件(用and、 or 、 not等布尔操作符联接起来),if语句又可以嵌套另一个if语句,要注意的是,不能在第一句之后、else 关键词之前加分号,否则编译器将告知语法错误。
elsebegin Showmessage('b比a大'); showmessage('hahaha');end;//带分号结果一 题目 delphi中if then else语句怎么写.举个最简单的例子 答案 if 条件表达式 then 语句1 else 语句2; if a>b then begin Showmessage('a比b大'); showmessage('haha'); end //不能带分号 else begin Showmessage('b比a...
delphiifelse Delphi if else ⽤法 delphiifelse 其实delphi中的IF语句和VB中的语句有点相像,都是IF ... THEN...不过DELPHI中的不同点就是语句的前后需要加个BEGIN,END.这个就相当于JAVA中的{}吧,呵呵。下边写⼏个IF语句的例⼦":1、IF.. THEN if 1=1 then begin //这⾥写执⾏语句 end;2...
begin (执行内容1);(执行内容2);end;3. IF (条件)then (执行内容)//注意 这里没有(;)号 else (执行内容)4. if (条件) then begin (执行内容1);(执行内容2);end //注意 这里没有(;)号 else begin (执行内容1);(执行内容2);end;总之,需要执行多行代码就用 begin end;框住 ...
1、IF.. THEN if 1=1 then begin//这里写执行语句 end;2、IF..ELSE if 1=1 then begin ...end //记住这里不能加分号。else begin ...end; //这里需要加分号 3、IF...ELSE IF..if 1=1 then begin ...end //记住这里不能加分号。else IF 1=2 THEN begin ...end; //这里...
delphi中if与else delphi中if与else program Project2;{$APPTYPE CONSOLE} uses SysUtils,windows;var i,j:integer; //i,j全局变量。begin i:=123;j:=323;if i<j then Writeln(i)else writeln(j);readln;end.00408316 . BB 7B000000 mov ebx,7B ; i=123 0040831B . BE 43010000...
if 条件表达式 then 语句1else 语句2;if a>b then begin Showmessage('a比b大'); showmessage('haha'); end //不能带分号elsebegin Showmessage('b比a大'); showmessage('hahaha');end;//带分号 解析看不懂?免费查看同类题视频解析查看解答
(1)if语句 if(条件表达式) then 语句//切记,如果有对应得else语句,则这里不能用分号 else 语句; (2)选择语句 Case 选择表达式 of 常量1: 语句1; ... Else ... End; 例如: case myChar of '+' : Text := 'Plus sign'; '-' : Text := 'Minus sign'; ...