The full error is stated as "The result of this expression is implicitly ignored. Consider using 'ignore' e.g. 'expr |> ignore', or ' e.g. 'let result = expr'"
Full disclosure -> I am totally new to F# and trying to get up to speed on how to translate where applicable my knowledge of OOP to Functional Programming. I saw 1 other post on SO for this specific error but it didn't directly relate to my scenario.
module WebAPI =
let DoesSpecifiedHeaderExist(content: string[], searchString: string) =
if (content.Length > 0) then
for s in content do
if (s.Trim() = searchString.Trim()) then true else false
else content |> ignore
Code requirement isn't complicated as I simply want to iterate through a string array searching for a value provided in searchString. If I find a match I return true otherwise return false. I'm sure there are other ways to do this but I'd really like to understand the issue.
The error is happening within the loop on the if..then..else block but I don't understand why I'm getting the error or how to correct the code. How is the result of the expression implicitly ignored when I'm explicitly returning either true or false on the condition and how can I correct it?