blob: 4f6bda6cfe3798337bcf44c79f9b4fba54208684 [file] [log] [blame]
Guillaume Gomezf9f934f2018-08-11 15:02:311// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
Guillaume Gomez1dd1f952018-06-15 21:23:112// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
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.
10
11#[doc(keyword = "fn")]
12//
13/// The `fn` keyword.
14///
15/// The `fn` keyword is used to declare a function.
16///
17/// Example:
18///
19/// ```rust
20/// fn some_function() {
21/// // code goes in here
22/// }
23/// ```
24///
25/// For more information about functions, take a look at the [Rust Book][book].
26///
27/// [book]: https://doc.rust-lang.org/book/second-edition/ch03-03-how-functions-work.html
28mod fn_keyword { }
Guillaume Gomezf9f934f2018-08-11 15:02:3129
30#[doc(keyword = "let")]
31//
32/// The `let` keyword.
33///
34/// The `let` keyword is used to declare a variable.
35///
36/// Example:
37///
38/// ```rust
39/// # #![allow(unused_assignments)]
40/// let x = 3; // We create a variable named `x` with the value `3`.
41/// ```
42///
43/// By default, all variables are **not** mutable. If you want a mutable variable,
44/// you'll have to use the `mut` keyword.
45///
46/// Example:
47///
48/// ```rust
49/// # #![allow(unused_assignments)]
50/// let mut x = 3; // We create a mutable variable named `x` with the value `3`.
51///
52/// x += 4; // `x` is now equal to `7`.
53/// ```
54///
55/// For more information about the `let` keyword, take a look at the [Rust Book][book].
56///
57/// [book]: https://doc.rust-lang.org/book/second-edition/ch03-01-variables-and-mutability.html
58mod let_keyword { }