Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using input for an 'if' statement.  RSS feed

 
Nate
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. I can create and access user input and then manipulate it. What I want to do is create an 'if' statement that depends in the user entered 'yes' or 'no' and then go on in the program accordingly. So how do I do this?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Welcome to JavaRanch! We don't have many rules here, but we do have a rule about what your display name needs to look like. Please head over to the "My Profile" link and see if you can't choose a more appropriate handle for yourself (your real name would be a great choice!)
Now, on to your question. If you've got a String variable "answer" which contains "yes" or "no", then you might write

Does this answer your question?
[ July 28, 2003: Message edited by: Ernest Friedman-Hill ]
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving this to Java Beginners since it doesn't deal with I/O or Streams
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!