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 trial

iOS

Johnny Nguyen
Johnny Nguyen
3,875 Points

What does a function without return do? I think a function without value doesn't mean anything

I'm learning function so I have this question that I wonder why

2 Answers

Hi there,

A function doesn't need to return something to be useful. It could test the state of something and make a sound if a certain state is detected. It could change the screen colour or make a notification light flash. It could prompt for user input and set a variable depending on what input is collected. There are many things that a function can do that doesn't require a value to be returned from it.

I hope that helps,

Steve.

Johnny Nguyen
Johnny Nguyen
3,875 Points

Thanks for your instant answer.

:+1: :+1: :+1: No problem!