W3cubDocs

/Rust

Literal expressions

Syntax
LiteralExpression :
CHAR_LITERAL
| STRING_LITERAL
| RAW_STRING_LITERAL
| BYTE_LITERAL
| BYTE_STRING_LITERAL
| RAW_BYTE_STRING_LITERAL
| INTEGER_LITERAL
| FLOAT_LITERAL
| BOOLEAN_LITERAL

A literal expression consists of one of the literal forms described earlier. It directly describes a number, character, string, or boolean value.

# #![allow(unused_variables)]
#fn main() {
"hello";   // string type
'5';       // character type
5;         // integer type
#}

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/reference/expressions/literal-expr.html