While this seems beyond simple to me, I caot seem to figure out how to code this. I am trying to write an if/else if/else statement, but it's not working. Here's what I have:
for value in values {
if Float(value) > 0 {
print("positive")
} else if value == "N/A" {
print("not available")
} else {
print("negative")
}
}
Values is an array of strings, where the value is either "1.0", "N/A", or "-1.0". Through array iteration, if it hits "N/A", it throws an error. I feel like I need to embed this in a try/catch block. It's catching a nil error. Thanks!
