Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The tricky for-loop

 
Tommaso Nuccio
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I got this question from javablackbelt.com, John Hunt's exam.
I cannot figure out the point here:


Why does it skip the for loop and prints "Total 0"?

Thanks in advance.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tommaso Nuccio:
...Why does it skip the for loop and prints "Total 0"? ...

"total" is set to zero, and the body of the loop will only execute if total is greater than 30.
 
Tommaso Nuccio
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dang,



I read it "until total is greater than 30".

Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic