Do formatted strings work in makecode?

It just shows the string using the curly brackets

The master documentation for MakeCode’s TypeScript interpreter [1] indicates that templated strings are supported. Prefix the curly braces with a dollar sign and try using backticks around your string templates. [2]


That’s only for JS formatted strings. The website above also cites that f-strings are currently unsupported in python, and I doubt the devs will change it. The str.format() method also seems to be missing so I feel like the only way to go about this is either concatenation (the ugly way) or the .join() method. Not ideal, but it is how it is I suppose.

Honestly, coming from a Python dev, my suggestion is you drop Python and use JS for MakeCode. I know it can be hard to make such a shift if you’ve never worked in JS before but it will make text code programming much more convenient because JS is native to pxt/makecode and it’s way less restrictive.

1 Like