2
Answers

Can somebody explain why this simple code doesnt work

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)
Next Recommended Forum