From e06ca6524447fc0e1adeef683a52a8bfd4a27707 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 20 Dec 2012 03:09:51 -0800 Subject: [PATCH] tutorial: Remove the section on constants We can mention that constants are declared with 'const' in one line. Don't need an entire section. --- doc/tutorial.md | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/doc/tutorial.md b/doc/tutorial.md index 5ac91438dc33..6fc379b6c673 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -342,34 +342,6 @@ character, such as `\n`, `\r`, and `\t`. String literals, written between double quotes, allow the same escape sequences. Rust strings may contain newlines. -## Constants - -Compile-time constants are declared with `const`. A constant may have any -scalar type (for example, integer or float). Other allowable constant types -are fixed-length vectors, static strings (more on this later), and -structs. Constants may be declared in any scope and may refer to other -constants. The compiler does not infer types for constants, so constants must -always be declared with a type annotation. By convention, they are written in -all capital letters. - -~~~ -// Scalars can be constants -const MY_PASSWORD: int = 12345; - -// Scalar constants can be combined with other constants -const MY_DOGGIES_PASSWORD: int = MY_PASSWORD + 1; - -// Fixed-length vectors -const MY_VECTORY_PASSWORD: [int * 5] = [1, 2, 3, 4, 5]; - -// Static strings -const MY_STRINGY_PASSWORD: &static/str = "12345"; - -// Structs -struct Password { value: int } -const MY_STRUCTY_PASSWORD: Password = Password { value: MY_PASSWORD }; -~~~ - ## Operators Rust's set of operators contains very few surprises. Arithmetic is done with