{"id":32,"date":"2022-12-06T19:10:47","date_gmt":"2022-12-07T02:10:47","guid":{"rendered":"https:\/\/www.rusttutorial.com\/?page_id=32"},"modified":"2025-08-21T19:00:44","modified_gmt":"2025-08-22T02:00:44","slug":"rust-hello-world","status":"publish","type":"page","link":"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/","title":{"rendered":"Rust Hello World"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to write the first Rust program called Hello, World!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='developing-the-rust-hello-world-program'>Developing the Rust Hello World program <a href=\"#developing-the-rust-hello-world-program\" class=\"anchor\" id=\"developing-the-rust-hello-world-program\" title=\"Anchor for Developing the Rust Hello World program\">#<\/a><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can follow these steps to develop the Hello World program in <a href=\"https:\/\/www.rusttutorial.com\/rust-tutorial\/what-is-rust\/\">Rust<\/a>:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='step-1-create-a-new-rust-project-folder'>Step 1: Create a New Rust Project Folder <a href=\"#step-1-create-a-new-rust-project-folder\" class=\"anchor\" id=\"step-1-create-a-new-rust-project-folder\" title=\"Anchor for Step 1: Create a New Rust Project Folder\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, open your command line tool (Command Prompt on Windows, Terminal on macOS\/Linux).<\/li>\n\n\n\n<li>Second, navigate to a directory where you want to save your Rust projects. For example:<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Rust\" data-shcb-language-slug=\"rust\"><span><code class=\"hljs language-rust\">cd Documents\nmkdir rust_projects \ncd rust_projects<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Rust<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">rust<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li>Third, create a new folder for your Hello World program:<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Rust\" data-shcb-language-slug=\"rust\"><span><code class=\"hljs language-rust\">mkdir hello_world\ncd hello_world<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Rust<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">rust<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='step-2-write-the-rust-code-in-an-editor'>Step 2: Write the Rust Code in an Editor <a href=\"#step-2-write-the-rust-code-in-an-editor\" class=\"anchor\" id=\"step-2-write-the-rust-code-in-an-editor\" title=\"Anchor for Step 2: Write the Rust Code in an Editor\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open your favorite text editor (e.g., VS Code, Sublime Text, or Notepad++).<\/li>\n\n\n\n<li>Inside the <code>hello_world<\/code> folder, create a file named <code>main.rs<\/code>.<\/li>\n\n\n\n<li>Write the following Rust code: <\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Rust\" data-shcb-language-slug=\"rust\"><span><code class=\"hljs language-rust\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">fn<\/span> <span class=\"hljs-title\">main<\/span><\/span>() {\n    <span class=\"hljs-built_in\">println!<\/span>(<span class=\"hljs-string\">\"Hello, world!\"<\/span>);\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Rust<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">rust<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='step-3-compile-the-program-using-rustc'>Step 3: Compile the Program Using rustc <a href=\"#step-3-compile-the-program-using-rustc\" class=\"anchor\" id=\"step-3-compile-the-program-using-rustc\" title=\"Anchor for Step 3: Compile the Program Using rustc\">#<\/a><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You need to compile Rust code before running. To do that you use the Rust compiler (<code>rustc<\/code>):<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>In your command line, ensure you are inside the <code>hello_world<\/code> folder.<\/li>\n\n\n\n<li>Run the following command to compile: <code>rustc main.rs<\/code><\/li>\n\n\n\n<li>This will create an executable file in the same folder.\n<ul class=\"wp-block-list\">\n<li>On Windows, the file will be named <code>main.exe<\/code>.<\/li>\n\n\n\n<li>On macOS\/Linux, the file will be named <code>main<\/code>.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id='step-4-run-the-program'>Step 4: Run the Program <a href=\"#step-4-run-the-program\" class=\"anchor\" id=\"step-4-run-the-program\" title=\"Anchor for Step 4: Run the Program\">#<\/a><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now, run the executable file you just compiled:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>On Windows: <code>main.exe<\/code><\/li>\n\n\n\n<li>On macOS\/Linux: <code>.\/main<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You should see this output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Rust\" data-shcb-language-slug=\"rust\"><span><code class=\"hljs language-rust\">Hello, world!<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Rust<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">rust<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='how-it-works'>How it works <a href=\"#how-it-works\" class=\"anchor\" id=\"how-it-works\" title=\"Anchor for How it works\">#<\/a><\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Rust\" data-shcb-language-slug=\"rust\"><span><code class=\"hljs language-rust\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">fn<\/span> <span class=\"hljs-title\">main<\/span><\/span>() { ... }<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Rust<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">rust<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li><code>fn<\/code> declares a <strong>function<\/strong>.<\/li>\n\n\n\n<li><code>main<\/code> is the <strong>entry point<\/strong> of every Rust program. When your program starts, Rust looks for and executes <code>main<\/code> first.<\/li>\n\n\n\n<li><code>()<\/code> means <code>main<\/code> takes <strong>no parameters<\/strong>.<\/li>\n\n\n\n<li>The curly braces <code>{ ... }<\/code> enclose the <strong>function body<\/strong> (the block of code that runs).<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Rust\" data-shcb-language-slug=\"rust\"><span><code class=\"hljs language-rust\"><span class=\"hljs-built_in\">println!<\/span>(<span class=\"hljs-string\">\"Hello, world!\"<\/span>);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Rust<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">rust<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li><code>println!<\/code> is a <strong>macro<\/strong> (not a regular function). The <code>!<\/code> indicates macro invocation. Macros generate code at compile time. For basic use, treat <code>println!<\/code> like a print function that adds a newline.<\/li>\n\n\n\n<li><code>\"Hello, world!\"<\/code> is a <strong>string literal<\/strong> of type <code>&amp;str<\/code>. The double quotes define a string literal.<\/li>\n\n\n\n<li>The <strong>semicolon<\/strong> <code>;<\/code> ends the statement. Rust use semicolon to separate lines of code.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='common-mistakes-and-how-to-fix-them'>Common Mistakes and How to Fix Them <a href=\"#common-mistakes-and-how-to-fix-them\" class=\"anchor\" id=\"common-mistakes-and-how-to-fix-them\" title=\"Anchor for Common Mistakes and How to Fix Them\">#<\/a><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here are some common mistakes you may encounter when writing the first Rust program:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='forgetting-the-in-println'>Forgetting the ! in println! <a href=\"#forgetting-the-in-println\" class=\"anchor\" id=\"forgetting-the-in-println\" title=\"Anchor for Forgetting the &lt;code&gt;!&lt;\/code&gt; in println!\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Wrong: <code>println(\"Hello\");<\/code><\/li>\n\n\n\n<li>Right: <code>println!(\"Hello\");<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>println!<\/code> is a macro; it must have <code>!<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='using-curly-quotes-instead-of-straight-quotes'>Using curly quotes instead of straight quotes <a href=\"#using-curly-quotes-instead-of-straight-quotes\" class=\"anchor\" id=\"using-curly-quotes-instead-of-straight-quotes\" title=\"Anchor for Using curly quotes instead of straight quotes\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Wrong: <code>println!(\u201cHello\u201d);<\/code><\/li>\n\n\n\n<li>Right: <code>println!(\"Hello\");<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Only straight ASCII quotes <code>\"<\/code> are valid string delimiters.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='missing-semicolon'>Missing semicolon <a href=\"#missing-semicolon\" class=\"anchor\" id=\"missing-semicolon\" title=\"Anchor for Missing semicolon\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Often harmless after a macro call in <code>main<\/code>, but as a rule of thumb, end statements with <code>;<\/code>.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id='mismatched-braces'>Mismatched braces <a href=\"#mismatched-braces\" class=\"anchor\" id=\"mismatched-braces\" title=\"Anchor for Mismatched braces\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ensure every <code>{<\/code> has a matching <code>}<\/code>.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='using-the-rust-playground-online'>Using the Rust Playground Online <a href=\"#using-the-rust-playground-online\" class=\"anchor\" id=\"using-the-rust-playground-online\" title=\"Anchor for Using the Rust Playground Online\">#<\/a><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/play.rust-lang.org\/\">Rust Playground<\/a> is an official browser-based editor that allows you to write, run, and share Rust code without installing anything on your computer. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This means you don\u2019t need to download or <a href=\"https:\/\/www.rusttutorial.com\/rust-tutorial\/installing-rust\/\">install<\/a> anything to start experimenting with Rust. It\u2019s perfect if you want to try out Rust quickly or test snippets of code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='why-use-the-playground'>Why Use the Playground? <a href=\"#why-use-the-playground\" class=\"anchor\" id=\"why-use-the-playground\" title=\"Anchor for Why Use the Playground?\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>No Installation Required<\/strong>: Great for trying Rust instantly.<\/li>\n\n\n\n<li><strong>Shareable Links<\/strong>: Easily share your code with others by sending a unique URL.<\/li>\n\n\n\n<li><strong>Safe Environment<\/strong>: Run code in a sandbox without worrying about affecting your computer.<\/li>\n\n\n\n<li><strong>Great for Learning<\/strong>: Test small code snippets while studying tutorials or books.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id='how-to-access-the-playground'>How to Access the Playground <a href=\"#how-to-access-the-playground\" class=\"anchor\" id=\"how-to-access-the-playground\" title=\"Anchor for How to Access the Playground\">#<\/a><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your web browser and go to: <a href=\"https:\/\/play.rust-lang.org\/\">https:\/\/play.rust-lang.org<\/a>.<\/li>\n\n\n\n<li>You will see a text editor where you can write your Rust code.<\/li>\n\n\n\n<li>And you&#8217;ll see the buttons to <strong>Run<\/strong>, <strong>Format<\/strong>, and <strong>Share<\/strong> your code.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id='key-features'>Key Features <a href=\"#key-features\" class=\"anchor\" id=\"key-features\" title=\"Anchor for Key Features\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Run Button<\/strong>: Compiles and executes your code instantly.<\/li>\n\n\n\n<li><strong>Share Button<\/strong>: Creates a shareable link to your code for forums, chat, or collaboration.<\/li>\n\n\n\n<li><strong>Format Button<\/strong>: Automatically formats your code according to Rust\u2019s style guidelines.<\/li>\n\n\n\n<li><strong>Tools Menu<\/strong>: Allows you to switch between stable, beta, or nightly Rust versions.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id='writing-your-first-code-in-the-playground'>Writing Your First Code in the Playground <a href=\"#writing-your-first-code-in-the-playground\" class=\"anchor\" id=\"writing-your-first-code-in-the-playground\" title=\"Anchor for Writing Your First Code in the Playground\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, in the top bar, keep \u201cChannel\u201d as <strong>Stable<\/strong> and \u201cMode\u201d as <strong>Debug<\/strong> (both are fine for this exercise).<\/li>\n\n\n\n<li>Second, enter the following code:<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Rust\" data-shcb-language-slug=\"rust\"><span><code class=\"hljs language-rust\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">fn<\/span> <span class=\"hljs-title\">main<\/span><\/span>() {\n    <span class=\"hljs-built_in\">println!<\/span>(<span class=\"hljs-string\">\"Hello, Rust Playground!\"<\/span>);\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Rust<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">rust<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li>Third, click the <strong>Run<\/strong> button. You will see the output appear below the editor.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id='when-should-you-use-the-playground'>When Should You Use the Playground? <a href=\"#when-should-you-use-the-playground\" class=\"anchor\" id=\"when-should-you-use-the-playground\" title=\"Anchor for When Should You Use the Playground?\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When you are learning Rust basics.<\/li>\n\n\n\n<li>When you want to test short code snippets before adding them to a project.<\/li>\n\n\n\n<li>When asking for help on Rust forums or communities, since you can share links.<\/li>\n\n\n\n<li>When you don\u2019t want to set up a Rust environment yet.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id='limitations-of-the-playground'>Limitations of the Playground <a href=\"#limitations-of-the-playground\" class=\"anchor\" id=\"limitations-of-the-playground\" title=\"Anchor for Limitations of the Playground\">#<\/a><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Not designed for large projects.<\/li>\n\n\n\n<li>Cannot interact with files or your local system.<\/li>\n\n\n\n<li>Limited to short, experimental programs.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='what-youve-learned'>What you&#8217;ve learned <a href=\"#what-youve-learned\" class=\"anchor\" id=\"what-youve-learned\" title=\"Anchor for What you&#039;ve learned\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>How to write the minimal Rust program.<\/li>\n\n\n\n<li>Why <code>main<\/code> is the entry point.<\/li>\n\n\n\n<li>How to print to standard output with <code>println!<\/code>.<\/li>\n\n\n\n<li>Basics of statements, string literals, and the semicolon.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<div class=\"wth-question\">Was this Helpful ?<\/div>\n\t<div class=\"wth-thumbs\">\n\t\t<button\n\t\t\tdata-post=\"32\"\n\t\t\tdata-post-url=\"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/\"\n\t\t\tdata-post-title=\"Rust Hello World\"\n\t\t\tdata-response=\"1\"\n\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t>\n\t\t\t<svg\n\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstroke-width=\"2\"\n\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t>\n\t\t\t\t<path\n\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t><\/path>\n\t\t\t<\/svg>\n\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t<\/button>\n\n\t\t<button\n\t\t\tdata-response=\"0\"\n\t\t\tdata-post=\"32\"\n\t\t\tdata-post-url=\"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/\"\n\t\t\tdata-post-title=\"Rust Hello World\"\n\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t>\n\t\t\t<svg\n\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstroke-width=\"2\"\n\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t>\n\t\t\t\t<path\n\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t><\/path>\n\t\t\t<\/svg>\n\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t<\/button>\n\t<\/div>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summary: in this tutorial, you&#8217;ll learn how to write the first Rust program called Hello, World! Developing the Rust Hello World program # You can follow these steps to develop the Hello World program in Rust: Step 1: Create a New Rust Project Folder # Step 2: Write the Rust Code in an Editor # [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":9,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-32","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Rust Hello World<\/title>\n<meta name=\"description\" content=\"In this tutorial, you&#039;ll learn how to write the first Rust program called Hello, World!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rust Hello World\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you&#039;ll learn how to write the first Rust program called Hello, World!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/\" \/>\n<meta property=\"og:site_name\" content=\"Rust Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-22T02:00:44+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/\",\"url\":\"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/\",\"name\":\"Rust Hello World\",\"isPartOf\":{\"@id\":\"https:\/\/www.rusttutorial.com\/#website\"},\"datePublished\":\"2022-12-07T02:10:47+00:00\",\"dateModified\":\"2025-08-22T02:00:44+00:00\",\"description\":\"In this tutorial, you'll learn how to write the first Rust program called Hello, World!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rusttutorial.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Rust Tutorial\",\"item\":\"https:\/\/www.rusttutorial.com\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Rust Hello World\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rusttutorial.com\/#website\",\"url\":\"https:\/\/www.rusttutorial.com\/\",\"name\":\"Rust Tutorial\",\"description\":\"Learn Rust Programming from Scratch\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rusttutorial.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Rust Hello World","description":"In this tutorial, you'll learn how to write the first Rust program called Hello, World!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/","og_locale":"en_US","og_type":"article","og_title":"Rust Hello World","og_description":"In this tutorial, you'll learn how to write the first Rust program called Hello, World!","og_url":"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/","og_site_name":"Rust Tutorial","article_modified_time":"2025-08-22T02:00:44+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/","url":"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/","name":"Rust Hello World","isPartOf":{"@id":"https:\/\/www.rusttutorial.com\/#website"},"datePublished":"2022-12-07T02:10:47+00:00","dateModified":"2025-08-22T02:00:44+00:00","description":"In this tutorial, you'll learn how to write the first Rust program called Hello, World!","breadcrumb":{"@id":"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.rusttutorial.com\/rust-tutorial\/rust-hello-world\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rusttutorial.com\/"},{"@type":"ListItem","position":2,"name":"Rust Tutorial","item":"https:\/\/www.rusttutorial.com\/"},{"@type":"ListItem","position":3,"name":"Rust Hello World"}]},{"@type":"WebSite","@id":"https:\/\/www.rusttutorial.com\/#website","url":"https:\/\/www.rusttutorial.com\/","name":"Rust Tutorial","description":"Learn Rust Programming from Scratch","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rusttutorial.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.rusttutorial.com\/wp-json\/wp\/v2\/pages\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rusttutorial.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.rusttutorial.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.rusttutorial.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rusttutorial.com\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":5,"href":"https:\/\/www.rusttutorial.com\/wp-json\/wp\/v2\/pages\/32\/revisions"}],"predecessor-version":[{"id":221,"href":"https:\/\/www.rusttutorial.com\/wp-json\/wp\/v2\/pages\/32\/revisions\/221"}],"up":[{"embeddable":true,"href":"https:\/\/www.rusttutorial.com\/wp-json\/wp\/v2\/pages\/9"}],"wp:attachment":[{"href":"https:\/\/www.rusttutorial.com\/wp-json\/wp\/v2\/media?parent=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}