Skip to content

Instantly share code, notes, and snippets.

@leohmoraes
Last active August 15, 2020 19:20
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 leohmoraes/08adc4b61a460be71b2ed29f959b2f80 to your computer and use it in GitHub Desktop.
Save leohmoraes/08adc4b61a460be71b2ed29f959b2f80 to your computer and use it in GitHub Desktop.
Ep03 - Dart - Funcoes puras e transparencia referencial
//https://youtu.be/4EzUtx-Q58I?t=1769
//Funcoes puras e transparencia referencial
import 'dart:math';
/// Funcao pura = sem side-effects
/// Altera somente as variaveis intenas
/// Doubles [n].
int double(int n) => n * 2;
/// Generate a possibly negative integer from -[max] to [max].
int randomIntWithNegative(int max) =>
Random().nextInt(max) * (Random().nextBool() ? 1 : -1);
main(){
}
/// Run https://dartpad.dev/08adc4b61a460be71b2ed29f959b2f80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment