Println the way of Kotlin or Swift

In Kotlin, we can write:

    fun greet(person: String): Unit {                               
       println("Hello, $person")

In Swift, we can write:

    func greet(person: String) {
       println("Hello, \(person)!")

In Julia, we can write:

    function greet(person::String)
        println("Hello, $person")

In Rust, we can write:

    fn greet(person: &str) {
       println!("Hello, {}", person)

Is there a way in Rust to make the println looks something like the one in Kotlin or Swift, i.e. replacing the "{}", person by something like {person} or \(person)

I think the closest that exists today in std is

fn greet(person: &str) {
   println!("Hello, {person}", person = person);

What if insted of person I’ve a value, x = 3 and need to write x+2,
In Kotlin => println(${x+2})
In Swift => println(\(x+2))

I tried in Rust => println("{value}, value = x+2) but it failed!

A side note, do you have an idea why the code you wrote is coloured, while the ones I wrote are not :slight_smile:

It works; you missed a quotation mark:

fn greet(x: i32) {
   println!("Hello, {y}", y = x+1);
fn foo() {}