New to coding, is there a way to make this short code better?

Updated on August 30, 2017 in  [G] Say Hello!
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
2 on August 29, 2017

Code:

Console.Write(“Write your age: “);
int age = Convert.ToInt32(Console.ReadLine());

if (age < 25)
Console.WriteLine(“You’re too young.”);

if (age >= 25)
Console.WriteLine(“You are free to enter. :)”);

Console.ReadKey();

Thankful for feedback. 🙂

  • Liked by
Reply
1 on August 30, 2017

put else in front of the second if that way it doesn’t check both if statements if age is less than 25.

on August 30, 2017

Ah I see, appreciate it!

Show more replies
  • Liked by
Reply
Cancel