I am working with our CRM program and coding some stuff into the system. I kind of get the basics, but I am not fully familiar with it so I am stuck trying to understand what this line means and what it actually does. Any help is truly appreciated.
Code looks something like this:
txtField.ReadOnly = (intOption = 0)
SetControlColor(txtField)
I know what intOption is, and I know what the outcome of the code is doing, but I don't understand what this line truly does...
Tear it apart. Read it from right to left. This part of the line:
is comparing whether
intOption
equals0
. This will returnTrue
orFalse
. ThatTrue
orFalse
value will then be assigned totxtField.ReadOnly
, which is aBoolean
type.It is equivalent to this code:
As you can see, it is easier to write all that code into one line.