Start learning free

LESSON 164 OF 671 · LOOPS & CONDITIONALS

Positive Number In Array: Buggy Code in Go

Practice

Inside the code editor we've tried to write a function that takes a slice nums as argument and returns true if there exists at least one positive (greater than zero) number in the slice; returns false otherwise.

So when we called the function for []int{-1, 2, 3}, we expected our code to print:

Array has positive numbers

but it seems like we made some mistakes because when we run our code, the Go compiler rejects it:

missing return

Assignment:

Your task is to fix our function.

STEP 1 OF 1
    Ctrl + Enter to check