I am trying to make a method in a new class that I made…
public void CalcDrinks(bool HealthOption)
{
if (HealthOption)
{
CostOfBeverage = 5M;
}
else
{
CostOfBeverage = 20M;
}
}
And I keep getting a red squiggly under the void saying… “expected class, delegate, enum, interface or struct error”
I’m not sure what I am missing…
Make sure the method is inside a class, and that the class/property/other method braces before and after the method line up. Also make sure that the previous statement has a
;(semicolon).This problem normally occurs because you have mismatched braces before the method or you have a missing semi-colon:
Correct
Incorrect