Software and Hardware Programming Software Objective
Sep 23, 2025

What does the null coalescing assignment operator (??=) do?

Choose the correct answer:
A) Assigns null to a variable
B) Assigns a value only if the variable is null
C) Compares two values for null
D) Throws an exception if null
Detailed Explanation

Explanation: The null coalescing assignment operator (??=) assigns the right-hand value only if the left-hand variable is null. It's shorthand for: $var = $var ?? $value;

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback