1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #[doc(keyword = "fn")]
15 /// The `fn` keyword is used to declare a function.
20 /// fn some_function() {
21 /// // code goes in here
25 /// For more information about functions, take a look at the [Rust Book][book].
27 /// [book]: https://doc.rust-lang.org/book/second-edition/ch03-03-how-functions-work.html
30 #[doc(keyword = "let")]
32 /// The `let` keyword.
34 /// The `let` keyword is used to declare a variable.
39 /// # #![allow(unused_assignments)]
40 /// let x = 3; // We create a variable named `x` with the value `3`.
43 /// By default, all variables are **not** mutable. If you want a mutable variable,
44 /// you'll have to use the `mut` keyword.
49 /// # #![allow(unused_assignments)]
50 /// let mut x = 3; // We create a mutable variable named `x` with the value `3`.
52 /// x += 4; // `x` is now equal to `7`.
55 /// For more information about the `let` keyword, take a look at the [Rust Book][book].
57 /// [book]: https://doc.rust-lang.org/book/second-edition/ch03-01-variables-and-mutability.html
60 #[doc(keyword = "struct")]
62 /// The `struct` keyword.
64 /// The `struct` keyword is used to define a struct type.
75 /// There are different kinds of structs. For more information, take a look at the
76 /// [Rust Book][book].
78 /// [book]: https://doc.rust-lang.org/book/second-edition/ch05-01-defining-structs.html
79 mod struct_keyword { }