Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Rust has been voted the most admired language in Stack Overflow's developer survey for nearly a decade running, and the reason is its core bargain: memory safety without a garbage collector, enforced at compile time by the borrow checker. AWS, Microsoft, and Discord ship Rust in production, and it became the first language after C to be accepted into the Linux kernel. Its compiler errors are famously helpful teachers. This page compiles your code with a recent stable rustc and runs the binary in a live terminal — stdin().read_line() blocks for genuine keyboard input — so you can wrestle with ownership from any browser, no rustup required.
use std::io::{self, Write};
fn main() {
print!("Enter a temperature in Fahrenheit: ");
io::stdout().flush().unwrap();
let mut line = String::new();
io::stdin().read_line(&mut line).expect("failed to read line");
let f: f64 = line.trim().parse().expect("please type a number");
let c = (f - 32.0) * 5.0 / 9.0;
let verdict = match c {
t if t < 0.0 => "below freezing!",
t if t > 30.0 => "properly hot!",
_ => "comfortable.",
};
println!("{f}\u{00b0}F = {c:.1}\u{00b0}C \u{2014} {verdict}");
}
Fight the borrow checker in short, low-stakes rounds — the proven way to internalize ownership, borrowing, and lifetimes — by running Rustlings-style drills with instant compiler feedback. Solve LeetCode problems in Rust to stand out in systems and blockchain interviews, verify how iterators chain with map, filter, and collect, or check whether a match expression covers every variant of your enum. Developers arriving from C++ or Go can port a familiar exercise here and let rustc's error messages narrate the differences.
Yes — the compiled binary runs in a real terminal session, so io::stdin().read_line() waits for you to type. One tip: print! doesn't flush automatically, so call io::stdout().flush() after a prompt (as our example does) to make sure the prompt text appears before the program blocks for input.
A recent stable rustc, so idiomatic modern Rust — the ? operator, inline format arguments like println!("{name}"), if let chains from stable releases, and the standard iterator adapters — compiles as expected. Nightly-only features behind #![feature] gates won't build; the compiler error will identify them right away.
No — there's no cargo and no network fetch in the sandbox, so external crates can't be used. The std library alone is deep enough for practice: collections (Vec, HashMap, BTreeMap), threads and channels from std::thread and std::sync::mpsc, string handling, and file-free I/O all work out of the box.
main.rsrustio::stdin().read_line()fn main() {
println!("Hello from Rust!");
println!("Welcome to XCODX Online Compiler!");
}