Ayfri
10/20/2022, 12:42 PMif
Sam
10/20/2022, 12:48 PMx = x ?: newValue
, but it feels a bit unintuitiveJohann Pardanaud
10/20/2022, 12:51 PMJohann Pardanaud
10/20/2022, 12:57 PMSam
10/20/2022, 12:58 PMJohann Pardanaud
10/20/2022, 1:01 PMJohann Pardanaud
10/20/2022, 1:04 PMif (x == null) x = newValue
it’s not that longJacob
10/20/2022, 3:59 PMx ?:= newValue
Klitos Kyriacou
10/20/2022, 4:42 PM??=
(since the C# has ??
as the equivalent of Kotlin's ?:
), called the "null-coalescing assignment operator".Ayfri
10/20/2022, 4:46 PMgildor
10/25/2022, 4:11 PMif
is simple and short enough already imo