A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

[C#] Check negative

1.3k views · started by Chad ·
#1
[C#] Check negative
Written for console. Change static to private or public for gui.

static bool CheckNegative(double Value)
{
return Value < 0 ? true : false;
}


example;

Console.WriteLine(CheckNegative(-50)); //Returns true
Console.WriteLine(CheckNegative(50)); //Returns false
#3
Could be shortened to:

        static bool CheckNegative(double Value)
{
return Value < 0;
}