三元運算 Ternary operator

C

x = (a > b ? a : b)

javascript

同C

PHP

同C

Lua

x = ((a>b) and  a or b)

Python

x=a if a>b else b

bash

[[ a -gt b ]] && x=$a || x=$b

results matching ""

    No results matching ""