Basics Flashcards
simple basics
what is the syntax for initializing a variable name x that is a 32 bit signed integer to the value -1?
let x: i32 = -1;
Is Rust a statically typed language?
yes
Is there a boolean type, what is it called and what are the values it can be
bool, true, false
rust character type, which coding is it ascii, unicode, utf-8?
char type, utf-8
what is the syntax for a Rust tuple
(“Ian”, 18)
What is the syntax for creating a reference called ref to a value called a ?
let ref = &a;
are variables mutable by default?
no
what is the syntax for declaring a mutable integer
let mut x = 4;
what is the basic “hello World” program
fn main(){ println!("Hello World"); }
snake_case is used by convention for which type names?
crates, modules, functions, methods
CamelCase is used by convention for which type names.
Types, traits, and enums
what is wrong with the following function? fn FnameBlaster ( val, u32) {
function name is not snake_case