# Using Rust Playground for Hello World and Variable Interpolation

DevFeed: [Using Rust Playground for Hello World and Variable Interpolation](<https://devfeed.tech/articles/using-rust-playground-for-hello-world-and-variable-interpolation-28320.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rust/2020/03/02/using-rust-playground-for-hello-world-and-variable-interpolation.html>)

Author: Fuzzygroup

Published: 2020-03-02T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [Code](<https://devfeed.tech/topics/code.md>), [compiled language](<https://devfeed.tech/topics/compiled-language.md>), [Repl.it](<https://devfeed.tech/topics/replit.md>), [browser](<https://devfeed.tech/topics/browser.md>)

Tags: [browser](<https://devfeed.tech/tags/browser.md>), [code](<https://devfeed.tech/tags/code.md>), [compiled-language](<https://devfeed.tech/tags/compiled-language.md>), [experiment](<https://devfeed.tech/tags/experiment.md>), [function](<https://devfeed.tech/tags/function.md>), [immutability](<https://devfeed.tech/tags/immutability.md>), [language](<https://devfeed.tech/tags/language.md>), [let](<https://devfeed.tech/tags/let.md>), [playground](<https://devfeed.tech/tags/playground.md>), [program](<https://devfeed.tech/tags/program.md>), [run](<https://devfeed.tech/tags/run.md>), [rust](<https://devfeed.tech/tags/rust.md>), [variables](<https://devfeed.tech/tags/variables.md>)

## AI overview

A beginner-oriented walkthrough of using Rust Playground to run a Hello World program and experiment with variables. It explains Rust syntax such as fn, println!, let, and string interpolation, and briefly compares Rust Playground with Repl.it, including a criticism of Repl.it's paid privacy option.

## Source excerpt

Artwork by my friend Autumn Mott; Hopefully I can find a better link to put here It is a Monday and what better way to start your 6 am Monday morning then learning some of the elements of a new language - Rust. I started by adding a link in my Browser toolbar to the Rust Playground which amounts to a web based REPL (Read Evaluate Print Loop) for Rust where you can type in Rust code and run it. Yes I know it really isn't a REPL because Rust is a compiled language not an interpreted one but it functions well enough as a REPL that I can wrap my Ruby tinged mind around it. Here's the Hello World program that automatically appears in the Rust playground fn main() { println!("Hello, world!"); } The output of this is: Hello, world! That's pretty easy to understand: A main function defined with fn A print line function defined with a ! (my previous Rust reading tells me that's a macro indicator) { and } to denote structure A ; to denote the end of lines I wanted to make a simple change to experiment with the use of variables so I added a main2() function and called it from main(): fn main() { println!("Hello, world!"); main2(); } fn main2() { let x = 5; println!("The value of x is: {}", x); let y = 6; println!("The value of y is: {}", y); } The output of this is: Hello, world! The value of x is: 5 The value of y is: 6 You can see that the let keyword assigns a variable and that {} binds a variable into a string (which is generally called interpolation). Note: Variables quickly bring you in to the heart of Rust - immutability - and here there by dragons that hopefully come up tomorrow after some reading. Link Here's a permanent link to this if you want to try it out. What about Repl.it? Another way to have a web based REPL for Rust is Repl.it. And while I like the concept of repl.it, they have eliminated any privacy without a paid account: Upgrade your account for private repls. This appears on the bottom of every new REPL you create and at $74 / 12 months that feels expensi