🧲 Interpolation
Published Aug 4, 2021Updated Sep 9, 2021
Contribute to Docs
String interpolation can be used to construct a string from a mix of constants, variables, and others by including their values inside a string literal.
In Emojicode, to insert a value into a string using string interpolation, we can write the variable inside two 🧲
s and it will print its value.
Suppose we have a constant named height
with a value of 3000
, and we want to use string interpolation to print out a fun fact:
3000 ➡️ height😀 🔤Alex Honnold climbed El Capitan, which is 🧲height🧲 feet, without a rope!🔤❗️
It will output:
Alex Honnold climbed El Capitan, which is 3000 feet, without a rope!
Example
💭 Tip Calculator🏁 🍇3.80 ➡️ tip😀 🔤The tip is $🧲tip🧲🔤❗️🍉
It will output:
The tip is 3.80
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Emojicode on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Free course
Learn Emojicode
🍇 Learn about Emojicode, a programming language that consists of emojis! 🍉Beginner Friendly1 hour