473,473 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

leaving an if statement (should be easy)

wandering if there is a way to leave a nested if statement to test the
next if statement

for example

if (i >= 6){
if (i >= 12)
cout << ">12\n"
else (what would i need to put here to leave this if-else block to
continue on to test the next condition?)
}
if (i >= 4){
if (i >= 6)
....
}

Sep 7 '05 #1
3 1741

"vamp4l" <va****@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
wandering if there is a way to leave a nested if statement to test the
next if statement

for example

if (i >= 6){
if (i >= 12)
cout << ">12\n"
else (what would i need to put here to leave this if-else block to
continue on to test the next condition?)
Nothing. Just drop the word "else" (and add a semicolon to the line above,
which needs one in either case).
}
if (i >= 4){
if (i >= 6)
....
}

Sep 7 '05 #2
doh..hehe thanks

Sep 7 '05 #3
vamp4l wrote:
wandering if there is a way to leave a nested if statement to test the
next if statement

for example

if (i >= 6){
if (i >= 12)
cout << ">12\n"
else (what would i need to put here to leave this if-else block to
continue on to test the next condition?)
}
if (i >= 4){
if (i >= 6)
....
}


if (i >= 12) { cout << ">12\n"; }

Generally

if (p) {
if (q) {
s;
}
}

should be written as

if (p && q) { s; }
August
Sep 7 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: PeopleIhavefeeling | last post by:
Real conspiracy theory's script: leaving the key Assalam u'Alekum :), The second night , before the two women came in, Mahmud Kurchu left a key with me, he told me I have to give this key to the...
11
by: Paul Rubin | last post by:
I frequently find myself writing stuff like # compute frob function, x has to be nonnegative x = read_input_data() assert x >= 0, x # mis-use of "assert" statement frob = sqrt(x)...
1
by: IVer Erling Årva | last post by:
I have a frameset where one frame contains a menu and the other the screens where the contents change depending on what the user clicks in the menu. Is there any relatively easy way to give the...
9
by: Targa | last post by:
Ive seen alert scripts triggered by links but I need one that will cover any link or pressing the back/forward buttons. Any such thing? TIA
35
by: Thierry Loiseau | last post by:
Hello all, and Happy end year 2005 ! Well, I would like to obtain a list of all JavaScript var statement, With "for...in" perharps ? That is bellow my recent test here, but the problem is...
9
by: Matt | last post by:
In many places in my application, I have a DataGridView which users can either enter data into or use as a method of navigation in a master/detail form view. I need a method of stopping the user...
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
20
by: John Salerno | last post by:
I'm starting out with this: try: if int(text) 0: return True else: self.error_message() return False except ValueError: self.error_message()
5
by: RSL101 | last post by:
Dear DBAs. I am wondering if anyone gotten good results leaving the, Monitor health of instance and databases (HEALTH_MON) = ON I find the default ON setting causes more problem than its...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.