MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/jtg3hx/getting_digits_using_switch_catch/gc72fk9/?context=3
r/badcode • u/HolySpecs • Nov 13 '20
52 comments sorted by
View all comments
3
I think this is better.
public static int evalDigit(string x) { int result = Convert.ToInt32(x); if(result > 9 || result < 0) { result = -1; } return result; }
Edit: Oh, it is in Java, I thought it was c#
2 u/Chroniaro Nov 13 '20 Pretty sure this would still compile in C#, but the camelCase method name and capital S in String kinda give it away
2
Pretty sure this would still compile in C#, but the camelCase method name and capital S in String kinda give it away
3
u/hhellloo Nov 13 '20
I think this is better.
Edit: Oh, it is in Java, I thought it was c#