Skip to content

Instantly share code, notes, and snippets.

@athulak
Created February 17, 2022 10:26
Show Gist options
  • Save athulak/bce12b5fabc16f00e5b71f3b36f100d5 to your computer and use it in GitHub Desktop.
Save athulak/bce12b5fabc16f00e5b71f3b36f100d5 to your computer and use it in GitHub Desktop.
Pass by Value vs Pass by Reference
void main() {
List<int> mithunMark = [10, 10, 10];
//List<int> johnMark = mithunMark;
List<int> johnMark = [...mithunMark];
mithunMark[0] = 20;
mithunMark[1] = 15;
print("Mithun's mark: "+mithunMark.toString());
print("John's mark: "+johnMark.toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment