Embedded Statement cannot be a declaration
Hi, I'm new to C# and struggling with this error. I think that the Variable cant be used because its not in the brackets but how do i fix this. This is the code and its for homework we have to create a program to determine what type of triangle it is and what the area is
8 Replies
Add brackets around each of the three statements
If you don't have brackets, then you can only have a single statement and which cannot be a variable declaration.
I.e.
Declare area before the ifs
oh yeah that too
Ahh Ok I didnt think you needed brackets because it was a single line didnt realise it could be a declaration
Should i delete the one before?
Missed that one. Then just skip all the sub-declarations
Don't declare area twice in any execution
Ahh ok also how would I fix these errors
look at the end of this line
Ah I see thank you