473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

difference between if, and while

what is the main differences between the two loops, and when is one better to use then the other?
so far I have fallen in love with if statements..........they seem easier, and
all I know about a while loop is that it is used when you need the loop to run at least once.

I hate our book for class it gives more questions they answers.

what are code tags? do they mean html code? is there somewhere to get which codes are legal?
Jul 26 '07 #1
2 5216
ravenspoint
111 100+
what is the main differences between the two loops,
and when is one better to use then the other?
so far I have fallen in love with if statements..........they seem easier, and
all I know about a while loop is that it is used when you need the loop to run at least once.

I hate our book for class it gives more questions they answers.

what are code tags? do they mean html code? is there somewhere to get which codes are legal?

It is unusual to describe the if statement as a kind of loop.

The statements following an if are executed exactly once if the if statement is true,

The statements following a while are executed over and over for as long as the while statement remains true.

A while loop may not run, even once.

Expand|Select|Wrap|Line Numbers
  1. int nyet = 0;
  2. while ( nyet ) {
  3.    ...  // this will not execute
  4. }
I am sorry you hate your class book. Since there are lots of places to find answers, but good questions are hard to find, you should try answering some of those questions.

I do not know what code tags are either, not without some context.
Jul 26 '07 #2
Meetee
931 Expert Mod 512MB
what are code tags? do they mean html code? is there somewhere to get which codes are legal?
When you write some code in your post, you have to give code tags to diffrentiate code with other text.Format is given in REPLY GUIDELINES at the right side where you write the post. In square bracket you need to write CODE and the at the end /CODE in square bracket.

Regards
Jul 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Edward Diener | last post by:
In the tutorial on functions there are sections on default arguments and keyword arguments, yet I don't see the syntactic difference between them. For default arguments the tutorial shows: def...
1
by: mike | last post by:
best regards: What is the difference between DOM Level 1 and DOM Level 2. Thank you. May god be with you.
3
by: RobG | last post by:
A little while ago I opined that do/while loops are harder to read than for loops, and therefore I preferred using for loops. However, it was pointed out that do/while has significant...
6
by: John Pass | last post by:
What is the difference between a While and Do While/Loop repetition structure. If they is no difference (as it seems) why do both exist?
4
by: pank7 | last post by:
hi everyone, I have a program here to test the file IO(actually output) with buffer turned on and off. What I want to see is that there will be obvious differece in time. Here I have an input...
5
by: kai | last post by:
Hi, In ASP.NET , what is the difference between OnClick and Click events for a button? Because we have button click event, it can trigger events, why we still need OnClick? Please help. ...
4
by: Uday Bidkar | last post by:
I am trying to register my interface with IConnectionPoint of outlook reminders to capture some Outlook Reminder events and having some issues. Here goes the pseudo code int APIENTRY...
8
by: weird0 | last post by:
Can anyone explain briefly what is the difference between inheritance and polymorphism? i read and seem to forget it again and again... Can anyone along with good examples of c# explain the...
9
by: Logan Lee | last post by:
Hi. What's the difference between while and do while?
11
by: cmb3587 | last post by:
I have two arrays and I'm trying to create a 3rd array that is the difference between the two arrays Ex: arrayA: 3 5 8 9 arrayB: 3 4 6 9 difference of A-B: 5 8 however, my...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
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,...
0
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...

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.