I cannot see any need to combine both in the same instruction, both return null if the item does not exist.
I wanted to avoid writing more than one line or having to get the value twice, e.g.
set value = array.GetAt("key")
if value = "" set value = "default"
I actually did it that way. But I could do it this way too:
set value = $select(array.GetAt("key") '= "" array.GetAt("key"), 1: "default")
But now I would be calling it twice which seemed like code smell for me.
- Log in to post comments