简单粗暴易懂。
result = ( a == 1 ) ? b : a == 2 ? c : null
附:
三目运算进行赋值
原文:https://www.cnblogs.com/luckgood/p/10436156.html