1. Home
  2. /
  3. Rust-playground
  4. /
  5. Rust Loop Example

Rust Loop Example - Rust-playground Typing CST Test

Loading…

Rust Loop Example — Rust-playground Code

Prints numbers from 1 to 5 using a for loop in Rust.

fn main() {
	for i in 1..=5 {
		println!("{}", i);
	}
}

Rust-playground Language Guide

Rust Playground is an official web-based tool for writing, compiling, and running Rust code in a browser. It allows developers to experiment with Rust code snippets, test features, and share examples without needing a local Rust setup.

Primary Use Cases

  • ▸Learning Rust programming online
  • ▸Experimenting with Rust features and syntax
  • ▸Testing Rust code snippets before integrating into larger projects
  • ▸Demonstrating Rust code in tutorials, blogs, or forums
  • ▸Sharing reproducible examples with other Rust developers

Notable Features

  • ▸Supports stable, beta, and nightly Rust toolchains
  • ▸Ability to run Rust code instantly in the browser
  • ▸Integration with popular crates from crates.io
  • ▸Shareable code snippets via URLs
  • ▸Syntax highlighting and code formatting

Origin & Creator

Rust Playground is maintained by the Rust Project developers and contributors, originally launched at 2015 to make Rust experimentation accessible without installing the Rust toolchain.

Industrial Note

Primarily used by Rust learners, educators, and developers experimenting with code snippets. Not suitable for production deployment or long-running projects.

More Rust-playground Typing Exercises

Hello World in Rust PlaygroundRust Variables ExampleRust If Statement ExampleRust Function ExampleRust Vector ExampleRust Mutable Variable ExampleRust Match Statement ExampleRust Struct ExampleRust Ownership Example

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher