Answer: Void expressions are the empty valued expressions. They do not have any values.
Example,
Console.WriteLine("Hi");
The above code prints the stuff present in the double quotes but we didn't had any value in it.
We cannot generate
complex expressions by using
void expressions as operands. If we do, it will throw a compile time error.
Example,
Console.WriteLine("Hi") + 5; // Error (Compile time)
The above code will gives a compile time error as we are trying to generate a
complex expression with
void expression.
Asked In: Spotted While Learning |
Alert Moderator