A Beginner Trying to Use Else Statements C#? -
I am sitting in a course for computing for the first time and I am trying to 'crack' it for one age ( I am very new to this ... sorry!). I can not build a simple if / other statement, in which the conditions are found, it writes a positive response, and if not, then negative feedback. But I'm getting errors: Invalid expression word 'other'
Only assignments, calls, increments, decreases and new object expression can be used as a statement
Forgive If it does not make any sense, I am confused! : (
Fixed zero main (string [] ARGs) {console.wedlines ("Do you prefer bananas?"); Console.readline (); if (console .readlines () == "yes"); {Console.WriteLine ("Thank you for your time!");} And; {Console.WriteLine ("Oh OK.")}}}}
}
You need to delete the semicolon that you have, usually its
if (condition) {// code} else {// code}
and if you have more than one condition that you can get then
if (condition) {// code} and if (condition 2) {// code} else {// code}
is not a status Then the last used is
if (condition) DoInterestingStuff (); Other DoNotDoInterestingStuff (););
Certain instances of situations (if u have narrative if-statements for clarification):
if (ban == true) if (banana) / As above (as = =) is false, it means that it is wrong if (totalBananas> = 10)
Comments
Post a Comment