• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Survey about continue, break and multiple return statements

 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A couple of times a year the discussion about whether to use continue, break and multiple return methods (in a single method) lights up. Every programmer has his own opinion about this it seems. To gain insight into this matter we started, as part of a course, a survey to see what people think about it. The survey consist of 2 parts, what you think about the usage of the statements and code fragments of which you need to find the outcome.

We would really appreciate it if you would fill in this survey. It won't take that long. Of course the results will be announced here. Maybe we can finally conclude this discussion...

The survey

Thank you very much,
Wouter
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The survey has been closed. Thank you for participating. We are now gathering the results and will publish them soon.
 
Saloon Keeper
Posts: 13984
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm looking forward to hearing the results
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh... will you publish the results for all who took.. or only top scorers i am eager to see the marks... but only can see you publish all the results... perhaps from bottom to top might be even more easier
 
Stephan van Hulst
Saloon Keeper
Posts: 13984
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think that's the point of the survey :P
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh ... we wont know how our marks for the test?
 
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since the survey was anonymous, it seems unlikely.
 
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I abandoned the survey when it seemed to be more about remembering the detail of auto-boxing and less about "continue, break and multiple return statements".
 
Ranch Hand
Posts: 326
Android Mac OS X Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the point was to show that with some of the constructions, it is hard to understand and/or read the code.

I copied the different questions and had a discussion yesterday with some colleagues. Some of the code-examples are doing the exact same thing. Only that where you use continue, break and multiple returns, most of the gang got the result wrong.

I will use some variants of the code examples in my classes to show how to write and how to not. Thanks Stephan Wouter for the excellent survey.
 
Stephan van Hulst
Saloon Keeper
Posts: 13984
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hang on hang on, as much as I would like to take the credit, it's Wouter's survey. I have absolutely nothing to do with it
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The survey was anonymous so you won't get your individual scores back. The results will probably be published after the weekend. A small teaser: one question was answered incorrectly by 60% of the respondents.

And thank you Stephan
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

James Sabre wrote:I abandoned the survey when it seemed to be more about remembering the detail of auto-boxing and less about "continue, break and multiple return statements".

The survey only has one question where an Integer is compared to an int. In the other cases the comparison is int vs. int. Only in the case of a comparison between an Integer and and Integer, which the survey didn't contain, must the details of auto-boxing be known (i.e. the auto-boxing caches).
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

A small teaser: one question was answered incorrectly by 60% of the respondents.



Which question was that?
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for(;;){
continue;
break;
return 0 ;
}
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I missed to answer this particular question sir
 
Sheriff
Posts: 22656
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That code won't even compile to due to unreachable statements.
 
Megha kharde
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this

for(;;){
System.out.println(" ");
if(true) continue;
else if(true)break;
else return 0 ;
}
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Wouter Oet wrote:The results will probably be published after the weekend.


hi was the results announced?
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sorry. There are some problems with entering our grade into the schools gradingsystem (read: the system that doesn't work all the time, if it works it works partially, students hate it, teachers hate it). Therefore you'll have to wait a little longer. I do hope and think that the problems will be solved quickly.
reply
    Bookmark Topic Watch Topic
  • New Topic