Comment

Comment by simonh

>that looks nothing like string formatting syntax used in any other language

PHP echo "There are $apples apples and $bananas bananas.";

Ruby puts "I have #{apples} apples"

TCL puts "I have $apples apples."

Typescript console.log(`I have ${apples} apples`);

Python print(f"I have {apples} apples")

Looks pretty similar to me, and if you like understand-ability by humans so much I think f-strings win hands down. But if you disagree, there's plenty of code out there still using % strings or .format() and they're not going anywhere any time soon.

parent simonh 7 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton