## ← Combining Strings Together

• 2 Followers
• 24 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): <script type="text/javascript" src='https://amara.org/embedder-iframe'></script> Paste this inside your HTML body, where you want to include the widget: <div class="amara-embed" data-url="http://www.youtube.com/watch?v=5Pl5KzGDZrs" data-team="udacity"></div> 13 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

1. Let's go over the answers
to these quiz questions.
2. Each of these lines of code
creates a string variable and
3. I wanted to know what is the value
that goes inside the string variable.
4. That means we need to evaluate this
expression which includes string
5. concatenation.
6. Part a says, String orderNumber
= "Order number:" + 23.
7. The value that gets stored in
this variable is Order number;23.
8. Notice that there's no space
after the semicolon because
9. the end quote is right
after the semicolon.
10. Since this is a string literal
concatenated with a integer literal,
11. then the whole thing
just turns into a string.
12. For part b, the right-hand side
of the equal sign evaluates
13. to the string You were served by Jack.
14. There's a space here
because there's a space
15. right before we have the end quote.
16. For part c, this string evaluates to
You are2cups away from a free drink.
17. The number 2 is an integer literal
value here because it's not in quotes.
18. It's just a plain number 2.
19. Since we have an integer
concatenated with a string,
20. it just becomes a string, and all
these parts are combined together, so
21. we pretend to squish them together.
22. And that's why there's
no spaces right here,
23. because there's no space after the are
and there's no space before the cups, so
24. are2cups is all combined with no spaces.