Created
February 26, 2020 13:28
-
-
Save digitaljoni/9800374ae7d176b9e4a558757a80a3a2 to your computer and use it in GitHub Desktop.
Null Aware Operators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() { | |
| String bonusItem1; | |
| if (bonusItem1 == null) { | |
| print('Your 1st bonus is a Powerbank'); | |
| } else { | |
| print('Your 1st bonus is a $bonusItem1'); | |
| } | |
| String bonusItem2; | |
| print('Your 2nd bonus is ${bonusItem2 ?? 'LCD Screen'} '); | |
| String bonusItem3; | |
| bonusItem3 ??= 'External Drive'; | |
| print('Your 3rd bonus is $bonusItem3'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment