Expand Ternary Expression
In This Article
Converts a ternary expression into an if/else block.
#Availability
Available from the context menus or via shortcuts:
- when the caret is on an expression containing a ternary operator (“? :” operator in C# and C++, IIf operator in Visual Basic).
#Notes
- This refactoring is the functional opposite of Compress to Ternary Expression.
#Example
│b = a ? 10 : 20;
│b = If(a, 10, 20)
Result:
if (a)
b = 10;
else
b = 20;
If a Then
b = 10
Else
b = 20
End If
#Animation
See Also