Skip to content

Instantly share code, notes, and snippets.

@timsneath
Last active February 7, 2023 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timsneath/a75fd9f76b5b61c42676c9232160d14d to your computer and use it in GitHub Desktop.
Save timsneath/a75fd9f76b5b61c42676c9232160d14d to your computer and use it in GitHub Desktop.
// A simple example of records and patterns
(double x, double y) getLocation(String name) {
if (name == 'Nairobi') {
return (1.2921, 36.8219);
}
else {
return (0, 0);
}
}
void main(List<String> args) {
final (lat, long) = getLocation('Nairobi');
print('Current location: $lat, $long');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment