Many situations arise when you have to choose between two options: true/false, male/female etc.
This short snippet will only allow two chars to pass through: capital 'Y' or capital 'N'.
The Read and ReadLine methods can serve also, but have the side effect you have to use Upper and Lower case methods if-statements, or (with ReadLine) testing if only 1 char is input etc.
Notice that the condition in the do - while has to be false.
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.