Dev study and notes

[dart] #13 #2.5 Sets (02:16) 본문

studyLog

[dart] #13 #2.5 Sets (02:16)

devlunch4 2023. 5. 2. 05:47
반응형
void main() {
    Set<int> setNumbers = {1, 2, 3, 4};
    setNumbers.add(1);
    setNumbers.add(1);
    setNumbers.add(1);
    setNumbers.add(1);
    print('setNumbers: $setNumbers');

    List<int> listNumbers = [1, 2, 3, 4];
    listNumbers.add(1);
    listNumbers.add(1);
    listNumbers.add(1);
    listNumbers.add(1);
    print('listNumbers: $listNumbers');

    var varIsSetNumbers = {1, 2, 3, 4};
    varIsSetNumbers.add(1);
    varIsSetNumbers.add(1);
    varIsSetNumbers.add(1);
    varIsSetNumbers.add(1);
    print('varIsSetNumbers: $varIsSetNumbers');
// PRINT
// >>>
// setNumbers: {1, 2, 3, 4}
// listNumbers: [1, 2, 3, 4, 1, 1, 1, 1]
// varIsSetNumbers: {1, 2, 3, 4}
}
반응형
Comments