Created
January 25, 2021 13:36
-
-
Save olumidayy/7bb8983ff3f38497ed7b6920d2105d1d to your computer and use it in GitHub Desktop.
This file contains 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
void main() { | |
// List<int> numbers = [1,2,3,4,5,6,7,8,9]; | |
// print('FOREACH METHOD'); | |
// numbers.forEach((number){ | |
// print(number*number); | |
// }); | |
// print('\nFOR LOOP'); | |
// for(int number in numbers){ | |
// print(number*number); | |
// } | |
String myName = 'Olumide'; | |
var length = myName.length; | |
// for(int i = 0; i < length; i++) { | |
// print(myName[i]); | |
// } | |
int index = 0; | |
while(index < length) { | |
print(myName[index]); | |
index += 1; | |
} | |
// var hours = 12; | |
// print('WHILE LOOP'); | |
// while(hours < 12) { | |
// print('The time is $hours:00'); | |
// // hours += 1; | |
// // hours = hours + 1; | |
// hours++; | |
// } | |
// print('\nDO-WHILE LOOP'); | |
// do { | |
// print('The time is $hours:00'); | |
// hours++; | |
// } while (hours < 12); | |
// List<String> passwords = ['abc', '188gbjhbk', 'hjjaijuui', 'ih197wuqghbiuKH9OIWA', 'Vy7u33']; | |
// passwords.forEach((password){ | |
// if(password.length < 5) { | |
// print('The password "$password" is too weak'); | |
// } | |
// else if(password.length <= 8){ | |
// print('The password "$password" is good'); | |
// } | |
// else if(password.length <= 12){ | |
// print('The password "$password" is quite strong'); | |
// } | |
// else { | |
// print('Wow, "$password" is a very strong password!'); | |
// } | |
// }); | |
// List<int> ages = [9, 12, 16, 13, 23, 18]; | |
// var message; | |
// for (var age in ages) { | |
// print('This person is $age years old'); | |
// if (age < 11) { | |
// message = 'Go to primary school'; | |
// } else if (age < 16) { | |
// message = 'GO to high school'; | |
// } else { | |
// message = 'Go to the university'; | |
// } | |
// print(message); | |
// } | |
// print("Hello world"); | |
// String firstname = 'Jackson'; | |
// String lastname = 'Michael'; | |
// int age = 30; | |
// var myString = 'My name is $firstname $lastname andd I am $age years old.'; | |
// print(myString); | |
// List<String> myList = ['Sodiq', 'Iyin', 'Peter', 'Sodiq']; | |
// print(myList.toSet()); | |
// Map myMap = { | |
// 'dart': 'flutter', | |
// 'javascript': 'react-native', | |
// false : 'flask' | |
// }; | |
// print(myMap[false]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment