Anonymous user
Associative array/Iteration: Difference between revisions
→{{header|Dart}}
No edit summary |
|||
Line 767:
=={{header|Dart}}==
<lang javascript>
main(){
var fruits = {
Line 775 ⟶ 776:
'plums': 'purple'
};
print('Key Value pairs:');
fruits.forEach( (fruits, color) => print( '$fruits are $color' ) );
print('\nKeys only:');
fruits.keys.forEach( ( key ) => print( key ) );
print('\nValues only:');
fruits.values.forEach( ( value ) => print( value ) );
}
</lang>
|