if else

Hi here is a snippet of my my code, the issue I was having was that after the the first condition was satisfied and the code in that block executed, the program went into the second block as well the "else if". Why did it do that, I thought that once the first conditional statement was satisfied it should skip the other two.

if(rightchild == 0){
rightchild = t;
}else if (rightchild->GetData() <= t->GetData()){
std::cout << t << "\n";
rightchild->Merge(t);
}else{
t->Merge(rightchild);
}
closed account (3bfGNwbp)
no, it shouldt be doing that. give full code
Are you positive that it's actually going to the else if? If that code block is straight from your program, if the first condition evaluates as true, the else's are skipped.
Topic archived. No new replies allowed.