Can somebody explain why this simple code doesnt work

Oct 8 2006 6:41 PM

Can somebody explain why even when the number generated isnt the number in the if statement it still runs?



using
System;

using System.Collections.Generic;

using System.Text;

namespace ConsoleApplication1

{

class Program

{

static void Main(string[] args)

{

Random r = new Random();

int scores = r.Next(1, 7);

System.Console.WriteLine("{0}", scores);

System.Console.ReadLine();

if (scores == 4) ;

{

System.Console.WriteLine("=4");

System.Console.ReadLine();

}

}

}

}


Thanks


Answers (2)