Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialZubeyr Aciksari
21,074 PointsDefine a function, named isOdd, to check if a number is odd. The function takes a number and returns either true or fals
Hi guys, i am stuck in here, please help!
Thanks in advance!
let numbers = [Int](0...50)
// Enter your code below
func isOdd(i: Int) -> Bool {
if (i in numbers % 2 == 0) {
return True
}
else {
return False
}
}
1 Answer
MUZ140348 Sympathy Makururu
10,209 Pointsfunc isOdd(i: Int) -> Bool{ return i % 2 != 0 }
Antonija Pek
5,819 PointsHow did you know that... Amazing.
Michael ninh
Courses Plus Student 2,176 PointsMichael ninh
Courses Plus Student 2,176 Points