About
Community
Bad Ideas
Drugs
Ego
Erotica
Fringe
Society
Technology
register | bbs | search | rss | faq | about
meet up | add to del.icio.us | digg it
Go Back   Community > Technology > Technophiliacs & Technophiles
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Technophiliacs & Technophiles The Technophiliacs forum is for discussing any and all forms of tech and other types of social backwardness. Including discussions of strange home-brewed hardware technology. Where to get good tools. How to make fiberglass molds. Computer hardware and software technolgy, including operating systems, applications, networking, hardware, CPU's, disk drives, and other geeky things. Viruses and Artificial Life discussions. How to write HTML. End user tools discussions and support issues. Gating the Internet with other nets.

Reply
 
Thread Tools Display Modes
 #1 
Old 2002-10-10, 02:32
d0m d0m is offline
Regular
 
Default how do nested if statements work in c++?

anyone got an easy way of explaining them?
 #2 
Old 2002-10-10, 03:47
cense cense is offline
Regular
 
Default Re: how do nested if statements work in c++?

It's simple really, as an example in pseudo code:

code:
if x equals 0 then

let x equal 1

if y equals 0 then
let y equal 1
end if

end if



The logic is: first, the value of x is checked to see if it is equal to 0. If so, it enters the loop, if not it exits the loop, which happens to be the end of my code snippet.

So lets say x does equal 0. then x is changed to 1. then y is checked the same way as x.

CLEARER: The second if statement (y) is only executed if the first if statement (x) is evaluated as true.

And the concept is the same no matter how many levels deep you nest your if loops.

[This message has been edited by cense (edited 10-10-2002).]
 
To the best of our knowledge, the text on this page may be freely reproduced and distributed.
 

totse.com certificate signatures
 
 
About | Community | Bad Ideas | Drugs | Ego | Erotica | Fringe | Society | Technology
Hot Topics