Hi,
I am wondering why the table variables inside while loop does not behave like other variables. Table variables created only once and will be used across through out whole looping. but other variables getting initialized every time when loop increases.
Check out the below code for more info
declare @tt int
set @tt =10
while @tt...
Hi
query level: beginner
as part of a learning exercise i have written code that must check if a string (as it is build up through raw_input) matches the beginning of any list item and if it equals any list item.
wordlist = ['hello', 'bye']
handlist = []
letter = raw_input('enter letter: ')
handlist.append(letter)
hand = "".joi...
I usually loop through lines in a file using the following code:
open my $fh, '<', $file or die "Could not open file $file for reading: $!\n";
while ( my $line = <$fh> ) {
...
}
However, in answering another question, Evan Carroll edited my answer, changing my while statement to:
while ( defined( my $line = <$fh> ) ) {
...
}
Hi...
This is one of the weirder things I've seen. I'm teaching an intro C++ course at a university, and one of my students contacted me saying that his code was running forever without stopping. I briefly glanced over his code during class, and didn't see anything immediately obvious, so I had him email me his code.
Without making any chang...
This program is supposed to judge the height of multiple buildings by the type of building and number of stories. There is a loop that continues to ask the questions until the user enters "0" for type of building. At the end, it prints a report showing the types of buildings and how many of each conform to building codes. I am having pro...
Hi there. I'm trying to figure out some answers to some questions and some difference between While and For loops in C++ and also the reasons? Here's what I've come up with so far. According to http://www.cplusplus.com/doc/tutorial/control/
While is:
while (expression) statement
and For is:
for (initialization; condition; increase) sta...
Hi there i'm trying to make a function in C++ that takes a number, i, and decides if it is a prime number or not by running through a loop to find it's multiples, and then makes sure it isn't prime through a series of test. However, it seems the loop isn't even being run through. I've told it to output no matter where in the loop it is, ...
I want to read data records from a non-seekable stream in Ruby. I want to leave it up to the user whether the current record should be skipped or read. Usually you would include Enumerable and provide the necessary methods for it to have an iterator in Ruby, but in my case data can be skipped and only one iteration is possible, so I'm no...
I have this while loop in xcode. The loop seems to work fine since I printed my i++ in console. But for some reason it only checks my IF statement the first time around. I can only add one title into the MutableArray called sectionZeroTitleArray. I have many arrays in this loop so it might get confusing. I will try my best to explain.
...
I'm making an app that lets people make surveys. My idea is to let people enter unlimited choices for a question, and to signal when they're done with that question by pressing Enter on a new line, at which point I let them enter the next question and that question's choices. I thought that pressing Enter on an empty line would result in...
Hi,
I would like something like that :
While Not RdoRst.EOF And RdoRst(2) = "Foo"
cboComboBox.AddItem RdoRst(1)
cboComboBox.ItemData(cboComboBox.NewIndex) = RdoRst(0)
RdoRst.MoveNext
Wend
I want that the expression 1 (Not RdoRst.EOF) is evaluated first. Then if it returns true, the expression 2 is evaluated t...
Okay, so I'm trying to create a list of he folders, and sub-folders and their files, but right now it doesn't print anything, and seems to be going into an infinite loop. Any idea why?
//infinate loop start
for(int j = 0; j < (int) dirs[i].folders.size(); j++){
dirs.push_back(Directory(dirs[i].folders[j]));
...
So i want to do a php while loop atleast 10 times to see if the value changes via a curl request but i only want to loop through a max of 10 times
so when true and loop count is less then 10
any ideas
...
Why does the following loop infinitely when a wrong input is entered? How do I correct this?
int operation;
while (true) {
cout << "What operation would you like to perform? Enter the number corresponding to the operation you would like to perform. ";
cin >> operation;
if (operation >= 1 && operation <= 5) b...
When C# throws an exception, it can have an inner exception. What I want to do is get the inner-most exception, or in other words, the leaf exception that doesn't have an inner exception. I can do this in a while loop:
while (e.InnerException != null)
{
e = e.InnerException;
}
But I was wondering if there was some one-liner I coul...
Okay, I'm trying to write a ruby simulation of my grandmother. I can't quite get the loop to work the way I'd like though. I want granny to respond with
"OH, THAT REMINDS ME OF BACK IN (random year) ..."
when you answer her in all caps but I also want her to respond with
"WHAT'D YOU SAY????"
when you don't use all caps. I can...
Why is my cin being skipped in the following while?
int main() {
int option;
cin >> option;
while(!cin.good()) {
cout << "Looping" << endl;
cin >> option;
}
}
...
Why is this loop only running once?
noteDatabaseItem just takes a node and fills in the data. the xml has 3 notes in it.
XML:
<?xml version="1.0" encoding="utf-8"?>
<noteCollection>
<note name="Test Note 1">This is test note 1 content!</note>
<note name="Test Note 2">This is test note 2 content!</note>
<note name="Test Note 3">Th...
I'm writing a loop in C, and I am just wondering on how to optimize it a bit. It's not crucial here as I'm just practicing, but for further knowledge, I'd like to know:
In a loop, for example the following snippet:
int i = 0;
while (i < 10) {
printf("%d\n", i);
i++;
}
Does the processor check both (i < 10) and (i == 10) for e...
Are nested while loops broken in golfscript or do I not know how to use them?
I want to iterate Q from 5 to 0, and for each iteration, iterate Z from 10 to 0. The single loops work well separately, and they seem self-contained (not relying on the stack between operations):
5:Q;
{"Q:"Q+ p Q}
{
Q 1- :Q;
}while
10:Z;{"Z:"Z+ p Z}{Z 1- :...