I am writing a program in which one of its characteristics is: no error occurs because of data entry that are not the same type of variable that receives it. And so I would know how to allow the user to enter only one data type at the prompt. I already know how to use try-catch, but I would like to do not use it.
Edit:
The user must to input only float type values
Please give me an example.
Since all command line parameters are strings, you can only parse them. If you expect a float value, you would do something like:
If the TryParse was a success, the value is now assigned to f. Otherwise, f == 0.0.