This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 12.2, “How to write text files in Scala.”
You want to write plain text to a file, such as a simple configuration file, text data file, or other plain-text document.
Scala doesn’t offer any special file writing capability, so fall back and use the Java
There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.