Created
July 21, 2020 11:55
-
-
Save dpossas/5766b215b587b909460dc548b413659b to your computer and use it in GitHub Desktop.
Dart - The basics in pratice
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
main () { | |
final shopping = new ShoppingCart (); | |
// the use of the reserved word new is optional as of DART 2.0 | |
// and we will not use it in the next lines | |
final pen = Product("Caneta", true, 4.75); | |
shopping.addItem(pen); | |
final pencil = Product("Pencil", false, 1.25); | |
shopping.addItem(pencil); | |
print ("Total purchase: $ {shopping.total ()}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment