I have an array and a string:
$header = ["Date", "Time", "Site Name", "Computer Name"]
columnName = "esfjk sdhf sdf"
and I am checking if $header contains columnName:
return if $header.include? columnName == false
The condition above always returns true, and the code carries on, even though the array doesn’t contain the string.
I also have the same issue when $hash is a hash and recordNum is a number such as 99999999 which is not in it, and I do:
return if $hash.has_key? recordNum == false
Any reason for this happening?
Precedence.
is interpreted as
that is, usually,
which is false. So what you want to do instead is this:
But in your particular case, I would do this (thanks, Alex Wayne):
And if you do that, then you can go back to the parentheses-less form: