Title: Insert Variables Into Strings
Slug: insert_variables_into_strings
Summary: Insert Variables Into Strings Using Scala.
Date: 2017-01-03 12:00
Category: Scala
Tags: Basics
Authors: Chris Albon
If you want a deeper guide to Scala, when I was learning I used Programming Scala and Scala for Data Science.
The proper term from this is string interpolation.
In [5]:
// Create some values
val number_of_soldiers: Short = 542
val casualties: Short = 32
In [12]:
print(f"Before the battle we had $number_of_soldiers soldiers. However, now we have ${number_of_soldiers - casualties}.")