开发者

Nested if..else... breaking parental flow?

I'm running through a few scenarios with some IFs and I'm running into something that defies my logic/understanding.

Yes, I'm very low-level with programming, so maybe I'm royally screwing up something very rudimentary.

Anyway, I have something like so:

if(condition==1) {
  if(conditionA==2) {
    // SAY I LOVE YOU
  } else {
    // SAY HEY BABY
  }
}

if(condition2==1) {
  if(conditionAA==2) {
    // SAY I LOVE YOU
  } else {
    // SAY HEY BABY
  }
}

Now, when condition1 and condition2 are both equal to 1 and conditionA and conditionAA do NOT equal 2, the else statements are fine. However, when conditionA or conditionAA DO equal 2, the whole scenario breaks at that very spot.

For example, conditionA DOES NOT equal 2, the else fires and if conditionAA IS equal to 2 ,stuff breaks there. If conditionA DID equal 2, the who开发者_如何学Pythonle thing breaks right there.

I don't understand why :(

Thanks in advance. Your advice will help me to restructure this mess.


I'm sorry... it was a bit of badness in the nested "IF". I was reestablishing a variable each time the nested "IF" was fired, making the original variable unavailable to later large scale evaluations.

I need to get more function/class savvy to get all this junk off of one page.

Thanks for jogging my mind, gang.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜