Assign Default Value to Variable if Second Variable is Null

/ Published in: C#
Save to your folder(s)

If you set the int keyword to be Nullable, then when x is declared there it's set to null.
On the second line, the "??" are saying if x is null then assign -1 instead.

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.