null-coalescing operators

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
baramuse
Posts: 84
Joined: Tue Nov 29, 2022 8:31 am
Location: France

null-coalescing operators

Post by baramuse »

Hi all,

I can't recall from the last summit if the null-coalescing operators are now supported by XSharp 2.18 ?
I've read in the forums that, yes, it's part of the 2.18, but can't find it in the "what's new" document.

Also what syntax is actually supported ?
I'm looking for the

Code: Select all

??=
one for example, would it be

Code: Select all

??:=
in X# ?

https://learn.microsoft.com/en-us/dotne ... g-operator

Regards.
User avatar
robert
Posts: 4124
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: null-coalescing operators

Post by robert »

Basile,
The null coalescing assign operator can be used like this, just like in C#

a ??= b

we also support

a := a ?? b

which is equivalent to

a := a DEFAULT b


Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
baramuse
Posts: 84
Joined: Tue Nov 29, 2022 8:31 am
Location: France

Re: null-coalescing operators

Post by baramuse »

Awesome, thanks !
Post Reply