When you do not have to say true or false
This is a misunderstood subject to some degree and once you grasp it, you will save a lot of unneeded code. Boolean (true/false) values can only have two possible outcomes. We are accustomed to Boolean fields (although they are best avoided for other reasons) , but all If() statements can only have one of two results (they are true or not).
Some control properties are also Boolean results – for example Visible. When you want to set the Visible property of a control conditionally, you might say something like on a button
If(
CheckBox.Value = true,
true,
false
)
So, if the control was checked, the button would appear. You can actually get rid of all the brackets and true / false statements and the Visible property of the button is simply
CheckBox.Value
What is happening here? The CheckBox value is either true or false, so set the Visible property of the control to whatever that value is.
This can be extended to quite complex statements – using the same button
(CheckBox.Value && !IsBlank(SearchBox.Text) || Dropdown.Selected.Value = "All"
If all of that is true, the button will appear – if any of it is false, the button will not be visible
This principal can be extended across all statements where a Boolean result is required and can also be done in the reverse – the ! operator means Not() and in the first statement above, the button would not be visible if the checkbox was checked
!CheckBox.Value