Untitled

 avatar
faisalsalameh
dart
a year ago
967 B
18
Indexable
void main() {
bmrFunction(weight:234,height:157,age:20);
}

String function3( String name){
  return name;
}

void bmrFunction({required double weight,double? height, double? age}){
  if(height == null && age == null){
    height = 157;
    age=20;
  }
  if(height != null && age == null){
    age=20;
    print(height);
    print(age);
  }
  if(height != null && age != null){
    print('all done');
  }else{
    print('no data');
  }
  
 double bmr = ( 88.362 + (13.397 * weight) + (4.799 * height!) - (5.677 * age!) ) * 1.725;
 print(bmr);
}

// one of theme is enter age or height
// two of theme are entered
// check if age or height ar null
// resolve the error




void function1( String name, int last){
  print(name);
  print(last);
}


void function({required String firstName,String? last}){
  String fullName ='';
  print(last);
  if(last == null)
  {
    fullName = firstName ;
  }
  else
  {
    fullName = firstName +' '+ last;
  }
  print(fullName);
}