Jump to content

about else if statements


cherri8

Recommended Posts

hi, I have a question about the code below which has always been on my mind.Is there a limit to how many times I use the elseif(condition) ?.the site only mentions that several blocks of code can be executed but i don't know the amount of code that can't be used.first i'll use the if statement to check if user inputs are empty and in the else statement it would contain more condition statements: in the if(condition) and elseif(condition) i will validate(for these conditions it would show true that there has been an error like for example: the users didn't use a proper email address) user inputs and in the else im plan to put user input in database( since the other conditions aren't true it would be safe to enter user data in database).thanks if (condition){code to be executed if condition is true;}elseif (condition){code to be executed if condition is true;}else{code to be executed if condition is false;}

Edited by cherri8
Link to comment
Share on other sites

Guest So Called

The number of if/elseif/else nests shouldn't be a problem. I didn't understand WTH the rest of your question was about, maybe I missed the prequel.

Link to comment
Share on other sites

The number of if/elseif/else nests shouldn't be a problem. I didn't understand WTH the rest of your question was about, maybe I missed the prequel.
Thanks but I don't know why the bold part was even necessary since I get that.you don't understand anything I wrote.It is hard to tell if you are trying to offend me?........
Link to comment
Share on other sites

Guest So Called

WTH = what the heck, I didn't understand the rest of your post except the part about the if/elseif/else.

Link to comment
Share on other sites

WTH = what the heck, I didn't understand the rest of your post except the part about the if/elseif/else.
I already know what wth means but i didnt know if you were trying to be rude to me.Wth or wtf is suppose to be offensive statements but i guess everyone doesn't know so nevermind.
Link to comment
Share on other sites

Well I'm sorry. If it will help I'll avoid trying to help you in the future.
Ok.Thanks It is alright if I don't receive your help anymore :).Im fine if others will do the same.For my last comment I wasnt saying that people who use wth or wtf are being rude or offensive but It only depends on how those statements are used and in what situation. If I explain further I might confuse you.I usually get made fun of about the way I write on the net.Good bye and thanks allot for your help. Sorry if you think I offended you. Edited by cherri8
Link to comment
Share on other sites

Remember though... with all the if, elseif's, only one can be true, if none are true, then the else will be executed:

if(){ }elseif() // for example: if this one is true, this gets executed and the ones below are not checked{ }elseif(){ }else // if none of the above are true, then this gets executed{ }

Edited by Don E
Link to comment
Share on other sites

Guest So Called
Ok.Thanks It is alright if I don't receive your help anymore :).Im fine if others will do the same.For my last comment I wasnt saying that people who use wth or wtf are being rude or offensive but It only depends on how those statements are used and in what situation. If I explain further I might confuse you.I usually get made fun of about the way I write on the net.Good bye and thanks allot for your help. Sorry if you think I offended you.
I was just trying to tell you that if there were more questions in the part that I didn't understand that you should rephrase them. The part I didn't understand looked like superfluous information about the first question.
Link to comment
Share on other sites

I was just trying to tell you that if there were more questions in the part that I didn't understand that you should rephrase them. The part I didn't understand looked like superfluous information about the first question.
HI During my third comment I understood what you meant by that.I should have been more clear.Both you and Don E answer all my questions perfectly.You all help me allot.Thanks
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...