Are multiple conditional operators in this situation a good idea?

前端 未结 21 2911
名媛妹妹
名媛妹妹 2020-12-15 06:23

I just saw this block of code on the Wikipedia article on conditional operators:

Vehicle new_vehicle = arg == \'B\' ? bus      :
                      arg ==         


        
21条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-15 07:23

    I like it. It is similar to an if-else-if ladder, only more concise.

提交回复
热议问题