I have two variables of type int? (or Nullable
NULL is not zero (numeric or binary value), a zero-length string, or blank (character value). So any comparison operator will always return false on it. Read more about it here
Since by default an int
cannot be null and its value will be set to 0
, the operator of > and < which is built for int
type, expects to work with values
and not with nulls
.
see my answer to a similar question where I wrote some ways to handle nullable int
with the less <
and greater >
operators https://stackoverflow.com/a/51507612/7003760