When migrating the ARM template expression [if(parameters('isComplete'), '1a', '2a')] to Bicep, which of the following expressions is equivalent?
Choose an answer
Tap an option to check your answer.
Correct answer: isComplete ? '1a' '2a'.
Why this is the answer
The correct answer is isComplete ? '1a' : '2a'. Bicep uses the ternary operator ? : for conditional expressions, which is a common syntax in many programming languages. This directly translates the ARM if function, where the first operand is the condition, the second is the result if true, and the third is the result if false. The option iif(isComplete, '1a', '2a') is incorrect because iif is not a valid Bicep function; it's sometimes seen in other scripting contexts. The option if(isComplete, '1a', '2a') is incorrect because Bicep does not have an if function for conditional expressions in this manner; if is used for conditional deployment of resources. The option if('isComplete') '1a' else '2a' is incorrect as it uses an if/else statement syntax, which is not how conditional expressions are formed in Bicep.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed