I wrote a console application in Python for a teacher a while ago, the usual grading calculations.This bit of code was preventing invalid input:
while True:
try:
Paper2 = float(input("Enter grade: "))
except ValueError:
print ("༼ つ ◕_◕ ༽つ error!")
continue
if Paper2 > 10:
print ("༼ つ ◕_◕ ༽つ error!")
continue
else:
break
How does one Try/except ValueError in C#?