+ 4

Help please, i cant find a mistake in C#

can u check mistakes? Many thanks for my helpers :) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { Console.Writeline("Enter Your Age, please") String YourAge = 0 Console.Readline() If (YourAge >= 18 ) Console.Writeline("You have authorized"); Else Console.Writeline("You didn't authorized"); } } }

17th Jul 2018, 5:19 PM
Shadowside
Shadowside - avatar
5 odpowiedzi
17th Jul 2018, 5:46 PM
Andre Daniel
Andre Daniel - avatar
+ 3
many thanks, good luck for you and your coding experience :))
17th Jul 2018, 5:54 PM
Shadowside
Shadowside - avatar
+ 2
You are welcome, have fun learning!
17th Jul 2018, 5:54 PM
Andre Daniel
Andre Daniel - avatar
+ 1
You did not assign YourAge. Shouldn't you do YourAge = Console.Readline(); ?
17th Jul 2018, 5:22 PM
Andre Daniel
Andre Daniel - avatar
+ 1
Well readline reads a string. You comparing it means it should he an integer. I don't know C#, but convert YourAge to an integer after you use ReadLine() Can you add the code to code playground and link it here? That will make it much easier to help.
17th Jul 2018, 5:34 PM
Andre Daniel
Andre Daniel - avatar