Last active
February 8, 2020 09:41
-
-
Save angwandi/bac9df9f69289f3684f8d501aaccbae8 to your computer and use it in GitHub Desktop.
Dart if statement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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