Skip to content

Latest commit

 

History

History
14 lines (12 loc) · 340 Bytes

File metadata and controls

14 lines (12 loc) · 340 Bytes

Inline null-check (null coalescing operator)

// manual way
if (lineStyle == null)
  this.lineStyle = new Styles.Line();
else
  this.lineStyle = lineStyle;

// inline if statement
this.lineStyle = (lineStyle == null) ? new Styles.Line() : lineStyle;

// null coalescing operator
this.lineStyle = lineStyle ?? new Styles.Line();