![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Hobbyist Programmer
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0
![]() |
Ok, I know this is pointless but, could you use the 'continue' comand with an 'if' statement to create a loop?
I know a 'while' or 'for' would be a lot easier but still just wondering ![]()
__________________
Don't wound what you can't kill |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Oct 2004
Posts: 67
Rep Power: 5
![]() |
i can't see how... but you could use
label: if() goto label; to create a loop...
__________________
coffee is my heroin. |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0
![]() |
i assume that you can't use 'contine' with if statements but i mean something like this.....
if (arg = true) { do summing arg++ continue } i know its pointless
__________________
Don't wound what you can't kill |
|
|
|
|
|
#4 |
|
Programmer
Join Date: Oct 2004
Location: Canada
Posts: 82
Rep Power: 5
![]() |
No, that won't work, you have to use goto or else a one of the three loops:
while ( ... ) {} do { } while(); for ( ; ; ; ) {} |
|
|
|
|
|
#5 |
|
Expert Programmer
|
Nope... thoug if is a control statement, it is not a control loop.
continue only works with control loops. You could use labels but why bother? Just use a while statement instead, since a while is really an if in loop form. You can than you continue and break to control your program flow inside the while statement.
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
|
|
#6 |
|
Programmer
Join Date: Oct 2004
Location: Canada
Posts: 82
Rep Power: 5
![]() |
I think that you are looking for the same behavior as:
do { ... }while( ... ); |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0
![]() |
I know what they all do, it was just something that came to me while I was sitting on the loo. Dunno why?
__________________
Don't wound what you can't kill |
|
|
|
|
|
#8 |
|
Newbie
Join Date: Oct 2004
Posts: 10
Rep Power: 0
![]() |
"goto" is the work of the devil, never ever use it in your code.
|
|
|
|
|
|
#9 |
|
Programming Guru
![]() |
see another goto hater
![]() disecting goto code is just wrong and should never have to be done.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity." - Albert Einstein |
|
|
|
|
|
#10 |
|
Programmer
Join Date: Oct 2004
Posts: 67
Rep Power: 5
![]() |
here we go again...
It's not gotos fault your code is unreadable, it's your fault...
__________________
coffee is my heroin. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|