if and else if statements in C++ -


what difference between this:

s = 0; if (x > 0) s++; if (y > 0) s++;

and this:

s = 0; if (x > 0) s++; else if (y > 0) s++;

any appreciated.

when write else if instead of if, program not check else if statement if x > 0, when write 2 if statements program check both conditions, no matter if x > 0 or not.


Comments

Popular posts from this blog

visual studio - vb.net filter binding source by time -

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -