0

going through the dart language documentation, coming from Swift background, when I try and check if condition inside list and based on it add a value its not getting added, can you please point out the error in my code , "James" is never printed

void main() {
  var  counter =  const [2,3];
  for (int i = 0; i < 5; i++) {
    print('hello ${i + 1}');
  }
 
  counter = [2,9];
  bool isEqual = counter == [2,9];
  
  var nav = ["Home", "Furniture", if (isEqual) "James"];
  
  print(nav);
  
}
multiverse
  • 425
  • 3
  • 13

0 Answers0