If within mapper

i’ve seen this before just cannot remember the syntax. how can i do an IF within a mapper? i want to say that if the $inventory != 0 then perform $period_revenue / $inventory = $price_per_unit other wise price_per_unit = 0

i’ve seen something like a switch statement before like $inventory != 0 : $period_revenue / $inventory but cannot remember the exact syntax.

try
$inventory != 0 ? $period_revenue/$inventory : 0

ah wonderful that did the trick! i forgot about the question mark.