+ 1

Can you help me figure out what I'm doing wrong?

static void Main(string[] args) { int Male; int Female; Console.WriteLine("Are you male or female?"); Female = female; Male = male; Console.ReadLine(); if Console.ReadLine = male; return Male; else if Console.ReadLine = female; return Female; } This is my code that I'm having issues with. I don't get what I'm doing wrong. It's C# coding and I'm confused. Help

14th Feb 2017, 12:16 AM
Tristen Alexander Diaz
Tristen Alexander Diaz - avatar
7 odpowiedzi
+ 2
The function Console.ReadLine() returns a value. You need to store that value in a variable in order to access it later. Good luck with future learning!
14th Feb 2017, 12:56 AM
Daniel W.
Daniel W. - avatar
+ 2
@Luke thanks for the tip but since the codes in main I didn't need the brackets, the code still works without them, and this is solved already :)
14th Feb 2017, 1:29 PM
Tristen Alexander Diaz
Tristen Alexander Diaz - avatar
+ 1
I have and I can't seem to find out what's wrong with my code, I've went through the course twice and I can't find my issue. please don't comment unless u know the issue I may have and Goodluck on python
14th Feb 2017, 12:44 AM
Tristen Alexander Diaz
Tristen Alexander Diaz - avatar
+ 1
thank you, it helped clear some of my problems I set Console.ReadLine(); to male and to female and when the user input male or female it calls upon the if and else if statements. Thank you for that clear up
14th Feb 2017, 1:01 AM
Tristen Alexander Diaz
Tristen Alexander Diaz - avatar
0
It seems there are a few things here which you might benefit from by going through the lessons once more.
14th Feb 2017, 12:37 AM
Daniel W.
Daniel W. - avatar
0
Where you write int male and int female, write string male and string female. (Int means numbers and string means letters and words).
14th Feb 2017, 6:51 AM
Luke Hegelund
Luke Hegelund - avatar
0
Where you write the if and else if statements, go like this: if __________ { ____________ } else if _____ { ____________ } Notice the curly brackets. ( {} )
14th Feb 2017, 6:59 AM
Luke Hegelund
Luke Hegelund - avatar