LIST IN DART
void main(){
List myList = ['Vanya' , 'rogersville', 'Harshi' , 'zxcvbnm', 'qwertyio'];
print(myList[2]);
print(myList.indexOf('Harshi'));
myList.add('asdfghjkl'); // to add new value
myList.insert(2,'lkjhg'); // to add value at specific index
print(myList);
myList. // various option are available , see when you write like this
}
do list ko banakar, we can compare like question and answer lists and match them
import 'dart:math';
void main(){
loveCalculator();
}
void loveCalculator(){
int loveScore = Random().nextInt(100) + 1 ;
print(loveScore);
if(loveScore > 80 && loveScore < 90){
print('True love');
}
if(loveScore > 90){
print('Pure Love');
}
else{
print('only attraction');
}
}
Conditional 'if statement' , 'if-else' , ' if-else if ' can be used
Comments
Post a Comment