Question about assignment with condition

I have a question that :
I want to make “numbera = 1” when “numberb = null”
and make “numbera = 2” when “numberb != null”
Is there any if experssion can be used in tf file?
How should I write the condition or if expression

Thanks a lot

You can see the conditional expression syntax in the docs here.

Your example might look something like

a = var.b == null ? 1 : 2

yes,what I want is Simplerway to resolve it,could you kindly give me some recommendation

I’m not sure what you are asking for, as the post by @jbardin gave the exact answer (the only adjustment might be numbera and var.numberb instead of a and var.b to match your question).