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 trialsai raman
1,341 PointsVIEW THE PREVIOUS FACT
when we try to click the showMore button ,the next fact is viewed .But what if we want to view the previous fact again? How do we write a code for the back button?
Mark VonGyer
21,239 PointsMark VonGyer
21,239 PointsBefore changing the string variable to a new string, set a new string variable to the existing string and then set the new string.
eg/
string 1 = "ants rock"
user clicks new fact
string 2 = string 1;
string 1 = "elephants rock"
Then make an additional button which will change the display string to string 2.