Learn

For the case of SMOOSHing together strings and variables, LOLCODE supports a popular shortcut called string interpolation. Interpolation here refers to placing variables within strings in an easier-to-read format.

We can insert a variable inside a string using :{, the variable name, and }.

I HAS A extension ITZ "aaaaaaa" BTW Results in "baklavaaaaaaa" VISIBLE "baklav:{extension}"

The terminal will output:

baklavaaaaaaa

Instructions

1.

Read in a firstName variable from the user.

Then print "Hello, " and firstName on the same line using string interpolation.

2.

Read in an additional variable, lastName.

Print out "Hello, ", firstName, and lastName on the same line using string interpolation, with spaces before firstName and lastName.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?