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:




Read in a firstName variable from the user.

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


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

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?