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 trialRasmus Living
801 PointsReturn two values from Struct
Hi.
Just completed Swift Build a Simple App, great tutorial!
Trying to make it a bit different, I'm now trying to return two different arrays with the same value of "randomNumber" from the same struct page.
I've tried making it to tuples, but get errors that say I can't return two Strings.
I can't formulate my problem in a good way since I'm still a beginner. So to make it simple: How do I return two different arrays to different functions in the ViewController, using the same value of the randomNumber?
1 Answer
ankushdharkar
7,530 PointsInstead of doing that, why not make two different functions, each handling a different array. Call them separately in each of your cases.