βœ… System.FormatException

Me and another are writing a RPN calculator. I get this error message when trying to calculate 3 4.8 5.7 + * 2.5 * but when he runs it he does not get an exception on it. We have the exact same files and code. Why?
No description
4 Replies
Angius
Angiusβ€’3mo ago
Your PC is probably set to a language that uses a comma as a decimal separator, not a period Try inputting the same string, but with commas Also, I recommend using TryParse() instead of the Convert class, it lets you check if a number is valid without throwing exceptions If you want to continue using periods for separators, you can set the culture of the thread to InvatiantCulture, or pass CultureInfo.InvariantCulture as a second parameter to your convert method Or to TryParse()
Merineth πŸ‡ΈπŸ‡ͺ
Could this issue be resolved by using Double instead?
Angius
Angiusβ€’3mo ago
No
Merineth πŸ‡ΈπŸ‡ͺ
Thanks king! works now :catHeyHello:
Want results from more Discord servers?
Add your server