would there be some way for a program to jump back to a previous point in the code? i know there probably is, and that this sounds like a dumb question, but im pretty new, well, thanks in advance for any help anyone can offer :)
Printable View
would there be some way for a program to jump back to a previous point in the code? i know there probably is, and that this sounds like a dumb question, but im pretty new, well, thanks in advance for any help anyone can offer :)
It would be helpful to express your idea is pseudocode or English.
This is exactly what a loop does: while a condition exists (or does not exist), do something; or for each item in a series of items, do something.
while( scan.hasNext() )
{
keepReading(lineOfInput);
}
OR
for( int i = 0; i < size(); ++i)
{
System.out.println(Array[i] + ", ");
}
Of course your loop can be very large
while (sentinel != -99 )
{
do a whole bunch of stuff;
}
Do you have some other "jump" in mind?
hmm, kindof... actually, most of my coding thus far has been on my graphing calculator, which i believe uses visual basic, if this is any help, on the calculator, it would be basically:
Point A
stuff
goto point A
and thanks for the help, i think i might be able to use that
using goto is generally not a good idea at all as there are much better ways to do it. Using goto makes for code that is very hard to read. The code you describe in your last post is a while-loop.
Code:while(someCondition)
{
//doStuff
}