This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

controls question

 
Erico Doon
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the output:8,4
can you tell me why?
[Dan added the UBB codes to format the code block.]
[ March 06, 2003: Message edited by: Dan Chisholm ]
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you step through the do loop, when you get to the expression j-- < 7, remember (or save) the current value of j, decrement j, then use the saved value of j to test j < 7. When you get to the expression i++ < 7, remember (or save) the current value of i, increment i, then use the saved value of i to test i < 7.
Here is the first time through the loop:
evaluate 9 < 4
decrement j to 8 before evaluating 9 < 7
increment i to 1
increment i to 2 before evaluating 1 < 7
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic