«Rust by Example»

0

Описание

https://doc.rust-lang.org/stable/rust-by-example/

1 страница из 184
читать на одной стр.
Настроики
A

Фон текста:

  • Текст
  • Текст
  • Текст
  • Текст
  • Аа

    Roboto

  • Аа

    Garamond

  • Аа

    Fira Sans

  • Аа

    Times

стр.

Rust is a modern systems programming language focusing on safety, speed, and concurrency. It accomplishes these goals by being memory safe without using garbage collection.

Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries. To get even more out of these examples, don't forget to install Rust locally and check out the official docs. Additionally for the curious, you can also check out the source code for this site.

Now let's begin!

Hello World

This is the source code of the traditional Hello World program.

// This is a comment, and is ignored by the compiler

// You can test this code by clicking the "Run" button over there ->

// or if you prefer to use your keyboard, you can use the "Ctrl + Enter" shortcut

// This code is editable, feel free to hack it!

// You can always return to the original code by clicking the "Reset" button ->

// This is the main function

fn main() {

// Statements here are executed when the compiled binary is called

// Print text to the console

println!("Hello World!");

הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

println! is a macro that prints text to the console.

A binary can be generated using the Rust compiler: rustc.

$ rustc hello.rs

rustc will produce a hello binary that can be executed.

Hello World!

Click 'Run' above to see the expected output. Next, add a new line with a second println! macro so that the output shows:

Hello World!

I'm a Rustacean!

Any program requires comments, and Rust supports a few different varieties:

   • Regular comments which are ignored by the compiler:

Комментарии к книге «Rust by Example», Collective of authors

Всего 0 комментариев

Комментариев к этой книге пока нет, будьте первым!

РЕКОМЕНДУЕМ К ПРОЧТЕНИЮ

Популярные и начинающие авторы, крупнейшие и нишевые издательства