Skip to main content

02-data types and another syntaxes

Lilya 黑静美Original...Less than 1 minuteprogramrustsyntax

1. How to name

In Rust, legal identifier names (for variables, functions, traits, etc.) must consist of letters, digits, and underscores, and cannot start with a digit. This is similar to many other languages. Rust will also allow other Unicode characters as identifiers in the future.

f.e.

let variable: i32 = 0;

???

let variable: i32;
println!("variable  = {}", variable); // error[E0381]: use of possibly unintialized 'variable' 
Last update:
Contributors: Heijingmei
Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v3.1.3