Add new comment

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Submitted by haroon (registered user) on Sat, 2007-01-20 10:16.

there is a confusion among a few about the following example,

if(condition)
echo “i am first line”;
echo “i am not executed”;

the above code doesn’t mean that the second line will never be executed. One should interpret this example with context to my explanation of IF statement before this example. I have not posted exact code but it’s kinda pseudo code to explain that if you are not making block of code using braces for your IF statement then the first line after IF will be executed as the part of IF statement and the lines following will not be executed as the part of IF though the control will go to them.

therefore to execute more than one line as part of IF statement you should use braces to make block of code.

 

 

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.

Reply

*
*
The content of this field is kept private and will not be shown publicly.


*

  • Images can be added to this post.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <div>
  • Lines and paragraphs break automatically.