How to interpolate strings in Kotlin programming language


Kotlin programming language has string interpolation similar to template literals in JavaScript

For JavaScript You can write as;

var passage = `I'm going todo a ${chore}`

In Kotlin you can do string interpolation as;

var passage = "I'm going todo a $chore"

Interpolating expressions in kotlin is done as;

var state = "I'm done with ${numChores()} chores"

Comments

Popular posts from this blog

Tar basic commands to store and extract files

Removing bash.sh #hash comments from a string using regEx in JavaScript

FlappingBird Postmortem (JS13K)

Npm how to install webpack nodejs

How to wait for a promise within a loop block