Skip to content

Instantly share code, notes, and snippets.

@AAQ-AND-DEV
Created March 20, 2019 20:03
Show Gist options
  • Save AAQ-AND-DEV/244f986be8960f3a6505cc5526315812 to your computer and use it in GitHub Desktop.
Save AAQ-AND-DEV/244f986be8960f3a6505cc5526315812 to your computer and use it in GitHub Desktop.
const and final workbook
void main() {
//each of these must be initialized and can't be changed
const pi = 3.14;
final pi2 = 3.14;
//final collections may be mutable, const collections immutable
const immutableList = [2,3,4,5,6];
//get 'unsupported operation: add' exception
//immutableList.add(7);
for (var num in immutableList) print(num);
final mutableList = [2,3,4,5,6];
mutableList.add(7);
for (var num in mutableList) print(num);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment