+ 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
7 Respostas
+ 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!
+ 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 :)
+ 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
+ 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
0
It seems there are a few things here which you might benefit from by going through the lessons once more.
0
Where you write int male and int female, write string male and string female. (Int means numbers and string means letters and words).
0
Where you write the if and else if statements, go like this:
if __________ {
____________
} else if _____ {
____________
}
Notice the curly brackets. ( {} )