![]() |
#21 |
Участник
|
Цитата:
![]() X++: static void tern_macro_test(Args _args) { #localmacro.tern #if.empty(%4) %1 ? %2 : %3 #endif #ifnot.empty(%4) if (%2) { %1 = %3; } else { %1 = %4; } #endif #endmacro anytype value, firstValue, secondValue; boolean useFirst; ; useFirst = true; firstValue = 1; secondValue = 2; info(strfmt("%1", #tern(useFirst, firstValue, secondValue))); useFirst = false; #tern(value, useFirst, firstValue, secondValue) info(strfmt("%1", value)); }
__________________
aLL woRk aNd nO JoY MAKes jAck a dULL Boy |
|
Теги |
ax2012, ax2012r3, тернарный оператор |
|
|