Spacing for print of basic user input - "Thith Means War" L3 Downcase!


#1

In Lesson 3 (Downcase!), the example is to print a request for user input + use gets.chomp. When I don’t add a space after the last word in the printed input request (“example?” vs. "example? ") the console prints the user input with no space ($ example?[cursor] vs. $ example? [cursor]). So when I add a space at the end of my input request it prints to the console with a space between the cursor.

My question is if I ought to make adding a space at the end of all my printed input requests a consideration? Is this isolated to the console, and addressed by CSS/SASS? Am I just noticing something that is irrelevant to the average project?

Thanks in advance. Cheers

Tony


#2

The console is what it is addressed toward, and a great consideration to the user, who is entering at the console. Their input will stand apart from the prompt message.

Aside:

The string method, .downcase! returns either a string with all characters in lower case, or nil if no change takes place. That leaves open the possibility of user_input being nil and thus having no methods or attributes. The same would apply if there is no user input, (just Enter).

There must be at least one upper case letter in the user input for there to be a string in user_input. If I read the intention of the author correctly, that is the point of this lesson… To apprise us of the difference between .downcase and .downcase!.

Might we please have a link to the this exercise just to check a couple of things out? Most appreciated.


#3

Thank you for the response Roy. After a few more lessons, and going back to the first part of this one to get the link for you, the answer to my question became apparent. I was referring to the space between a printed user input request and the cursor in the console, and based on the sample code I have seen it is best practice to end user input requests with a space.

Link to the lesson.


#4

You’re describing what you want. So if you want a space, that’d go into your description. Your decision.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.