Skip to content

Instantly share code, notes, and snippets.

@angwandi
Last active February 8, 2020 09:41
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 angwandi/bac9df9f69289f3684f8d501aaccbae8 to your computer and use it in GitHub Desktop.
Save angwandi/bac9df9f69289f3684f8d501aaccbae8 to your computer and use it in GitHub Desktop.
Dart if statement
import 'dart:math';
void main(){
loveCalculator();
}
void loveCalculator(){
int loveScore = Random().nextInt(100) + 1;
print(loveScore);
// if and if
if (loveScore > 70){
print('You love each other');
}
if(loveScore>50 && loveScore < 70){
print('You like each other.');
}
if(loveScore < 50){
print('You don\'t like each other.');
}
// if else : same as above
if (loveScore > 70){
print('You love each other');
}
else if(loveScore > 50){
print('You like each other.');
}
else{
print('You don\'t like each other.');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment