• Post Reply Bookmark Topic Watch Topic
  • New Topic

not recognizing a user input

 
Ryan Bishop
Ranch Hand
Posts: 143
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm doing a problem where someone will input a name and it will show their title or vice versa. It works fine when
the user inputs the name but whenever they input a title it is coming back not found. Not sure what I did wrong.

 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint : Why are you setting textFound to true on line 68 ?
 
Ryan Bishop
Ranch Hand
Posts: 143
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know. Think I've confused myself beyond repair. I mean, I know textFound based on what you say isn't right but can't figure out what is.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have two blocks of code that both do basically similar things. Lines 42 - 60 check if the person's name has been entered and then fills in their job, whereas lines 61 - 80 check if a person's job has been entered and then fills in their name.
You know one of those blocks of code works correctly and the other one doesn't and I've told you that the problem is related to the textFound variable, so you just need to look at how that variable is used in the first block and how it is used or (hint, hint) not used in the second block.
 
Ryan Bishop
Ranch Hand
Posts: 143
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like this?

 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ryan Bishop wrote:Like this?

Did it fix the problem ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!