• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

for(...) not working right

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why isn't this working? I need to go through each variable and set it by hand...meaning that I'm expecting this inputDialog to pop up 20 times...however, I'm only getting through the first loop. I can only enter values for salesperson # 0. Any ideas?
 
Bartender
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
David Crossett
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you! Duh!
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe, please allow me to question your answer. I usually read every Beginner post, & it's been quite an effective training tool, but your "one line answer" to this question is the SAME line he has in his code.

He seems to get it(ref. the "DUH!), but I'm not sure I do.
Is the problem here that he tests i, but increments j ?
Thanks, -Bill.
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think he was pointing out the "i < ..." which should be "j < ...".
 
Bill Raterink
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ouch! I almost broke my arm.....patting myself on the back. HA!HA! I was hoping THAT was the "cure". Hey, at this rate, I'll make that intermediate level in no time. Thanks again, guys. -Bill.
 
Joe Ess
Bartender
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Bill Raterink:
Joe, please allow me to question your answer. I usually read every Beginner post, & it's been quite an effective training tool, but your "one line answer" to this question is the SAME line he has in his code.


I try to make it easier on the folks who are learning, but not too easy (i.e. narrowing down the problem to one line but NOT pointing out the problem). The beginner gets the satisfaction of solving a problem (that "AH-HA!" moment), builds an association between the symptoms of a problem and their solution and gives them self-confidence that they CAN solve their own problems (so they aren't stuck in this forum forever).
 
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic