4 ms·
The unwrapping is implicit so you can pretend it's not there until you absolutely need it. To take a related example from c# (please excuse my pseudo c#, I'm ru
by iamcurious 5y ago
The unwrapping is implicit so you can pretend it's not there until you absolutely need it. To take a related example from c# (please excuse my pseudo c#, I'm rusty) you can use the operator ?. to say:
return myList?.deleteFirst?.takeFirst?.name
you could also say:
if (myList != null){
firstDeleted = myList.deleteFirst;
if (firstDeleted != null){
newFirst = myList.takeFirst;
if( newFirst != null){
return name;
}
}
}
but I find the first one much easier to think about.