How to use a Ternary Operator with multiple condition in flutter dart?

后端 未结 6 1006
逝去的感伤
逝去的感伤 2021-02-03 10:28

how to use ternary if else with two or more condition using \"OR\" and \"AND\" like

    if(foo == 1 || foo == 2)
     {
      do something
      }
     {
      e         


        
6条回答
  •  感情败类
    2021-02-03 10:49

    void main(){
      var a,b,c,d;  
      a = 7;  
      b = 9;  
      c = 11;  
      d = 15;  
      print((a>b)?((a>c)?((a>d)?a:d):c):(b>c)?((b>d)?b:d):(c>d)?c:d);
    }
    

提交回复
热议问题