C
C#2y ago
maroonlol

My code is stuck in a infinity loop

https://github.com/AbdulRaheemNazir/MiniApps/blob/main/Just%20need%20random%20Symbol When I try to run it runs infinitly it was working fine untill i started making it to use random plus or minus operations
GitHub
MiniApps/Just need random Symbol at main · AbdulRaheemNazir/MiniApps
Contribute to AbdulRaheemNazir/MiniApps development by creating an account on GitHub.
5 Replies
Kouhai
Kouhai2y ago
Two things to consider 1 - int.Parse(sym) is invalid, sym is a string that can't be parsed. 2 - Your code could have a StackOverflowException And just FYI, sameanswer = numberx + int.Parse(sym) + numbery; This line doesn't do what you expect it to do
maroonlol
maroonlol2y ago
Yeah but if remove the int.parse I get this
maroonlol
maroonlol2y ago
maroonlol
maroonlol2y ago
What do I do in order to do whatever operation when a random is given
Kouhai
Kouhai2y ago
To evaluate that expression, you'll either build your own system (which could be as simple as a switch with few cases) or you can use libraries to do that