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 trialMichael Robert McGowan
2,075 PointsSimplified
Would it not be possible to simply add a space within the quotation marks at the end of the sentence?
4 Answers
Steven Parker
231,268 PointsThe tentative answer would be "yes", but it might depend on what is being done overall. Does your question pertain to something at a particular time index in the video? Please provide that time and/or a more explicit description of the situation for a more definitive answer.
UPDATE: Now that I've seen the function in question, yes, you could just add a space to every question string passed to the function. But since the "Ask" function might be used many times in the program, it makes sense to add on a space there. A more sophisticated version might even test the last character of the argument string, and add a space on only when the last character was not already a space.
Michael Robert McGowan
2,075 PointsIts in ref to the first sentence that is adjusted for the users answer. A simple " " was added to the end of a sentence.
I understand explaining the concept for including that in an additional entry being included but wasnt sure if i missed why a sentence couldnt just be expanded in the case of the first example,
Its more to understand, if having spacing at the end of a question causes problems down the line id like to avoid xD
Steven Parker
231,268 PointsCan you give a specific time reference in the video, and/or post the actual code line(s) involved?
Michael Robert McGowan
2,075 PointsRight at the beginning of the video and around the 03:30 mark.
string entry = Ask("How many cans are you ordering?"); - This statement
Steven Parker
231,268 PointsI expanded my answer above.
Michael Robert McGowan
2,075 PointsThank you, I appreciate your response, I thought it could be something like that, but thought I would ask for clarification. Thank you very much!