GiantMatrix
asked on
If statement question
Hi All,
I've a very simple question about Delphi IF statement. Now I really get confused about the semicolon (;) and the Begin End blocks. As of the (;) in Delphi IF statements I need to understand when to put them and when not to put them.
As of the Begin - End blocks, when shall I add code under Begin-End block and when not.
So I will appreciate it so much if someone can please explain those two issues to me.
**** NO links to tutorials or help files ****
I've a very simple question about Delphi IF statement. Now I really get confused about the semicolon (;) and the Begin End blocks. As of the (;) in Delphi IF statements I need to understand when to put them and when not to put them.
As of the Begin - End blocks, when shall I add code under Begin-End block and when not.
So I will appreciate it so much if someone can please explain those two issues to me.
**** NO links to tutorials or help files ****
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
IF condition THEN
BEGIN
statement1;
statement2;
END (* No semicolon since ELSE block is present*)
ELSE
BEGIN
statement3;
statement4;
END;
BEGIN
statement1;
statement2;
END (* No semicolon since ELSE block is present*)
ELSE
BEGIN
statement3;
statement4;
END;
IF condition1 THEN
BEGIN
statement1;
statement2;
END (* No semicolon since ELSE block is present *)
ELSE IF condition2 THEN
BEGIN
statement3;
statement4;
END (* No semicolon since ELSE block is present *)
ELSE
BEGIN
statement5;
statement6;
END;
BEGIN
statement1;
statement2;
END (* No semicolon since ELSE block is present *)
ELSE IF condition2 THEN
BEGIN
statement3;
statement4;
END (* No semicolon since ELSE block is present *)
ELSE
BEGIN
statement5;
statement6;
END;
ASKER
Hi Harish,
Thank you so much for your outstanding help and support :-)
Thanks in advance!
Thank you so much for your outstanding help and support :-)
Thanks in advance!
ASKER
What if I have a Begin End block inside the IF or Else If, can you please give me an example for this?
I've visited the link you provided here although I already know it and it does not include an answer to my previous question...actually that is why I said **** NO links to tutorials or help files ****.
Anyway, can you please give me an example for IF - ELSE IF - ELSE statement with (begin end) inside the else if and if.
Thanks in advance!