diff --git a/ch05/ex5-1.md b/ch05/ex5-1.md index eb3a617..ab0d7db 100644 --- a/ch05/ex5-1.md +++ b/ch05/ex5-1.md @@ -4,33 +4,11 @@ ```dart void main() { - Map movieInformation = {0: 'Star wars'}; - - // Add element to Map - movieInformation[1] = 'Empire Strikes Back'; - movieInformation[2] = 'Return of the Jedi'; - - // Loop through Map - movieInformation.keys.forEach( - (k) => print('Key: $k, Value: ${movieInformation[k]}') - ); - - // Show the keys - print('Keys: ${movieInformation.keys}'); - - // Show the values - print('Values: ${movieInformation.values}'); + List listMonths = ['January', 'February', 'March']; + listMonths.add('April'); + listMonths.forEach(print); +} +``` - // Remove element from map using the key - movieInformation.remove(0); - // Loop through Map - movieInformation.keys.forEach( - (k) => print('Key: $k, Value: ${movieInformation[k]}') - ); - // Check if a key exists - print('Key 1 exists: ${movieInformation.containsKey(1)}'); - print('Value Star Wars exists: ${movieInformation.containsValue('Star Wars')}'); -} -```