Getting around error in c#
Go to solution
Solved by MikeD,
I imagine you are getting the error after the if blocks.
Unlike some languages (Python is an example I believe) C# variables are scoped. If you define, like you are doing, a variable inside the if block it will not be visible outside. You have to declare the variable outside and assign it in the ifs.
You are probably going to have to use a supertype of the monster instances you are creating and assigning the actual monster to it.
-
Featured Topics
-
Topics
-
0
-
Tbaile ·
Posted in Laptops and Pre-Built Systems1 -
2
-
fxuplodeskyking ·
Posted in Troubleshooting0 -
0
-
PeachyUwUSenpai ·
Posted in CPUs, Motherboards, and Memory2 -
8
-
4
-
Britishblue ·
Posted in Networking6 -
7
-
-
play_circle_filled
Latest From Tech Quickie:
Ethernet Is Named After Something Really Dumb (and other tech stories)
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now