I have a method Test which accepts x as an optional parameter. X can accept positive,negative and zero value. I need to check if double is null then print the value of x else if double value is null then print its null. As default value of double is 0 and double can't be assigned to null, so how can i do this?
public static void Test([Optional] double x)
{
//if x is not null print value of x
//else print x is null
}
static void main()
{
Test();-output expected x is null
Test(5);-output expected x is 5
Test(0);--output expected x is 0
Test(-1);-output expected x is -1
}