as of https://github.com/roc-lang/roc/pull/5707 you can now use expressions in string interpolation, e.g. "this is a number: \(Num.toStr someNumber)"
the new rules for string interpolation are:
that's it!
that means you can also do quotes in there if you want, e.g. "comma-separated: \(Str.joinWith ["a", "b", "c"] ", ")"
Exciting
That will be nice in many scripts
when you say "no interpolation inside other interpolations" - is that only for inline stuff or does it actually care if Str.joinWith
uses interpolation in its implementation?
Only for inline stuff! The implementation of the functions used doesn't matter.
Last updated: Jul 05 2025 at 12:14 UTC