Rust on android part 2
Today we age going to know about what is cargo and how to generate a rust package using it.
cargo is a package manager in rust , we can check the version of the installed version of cargo using
"cargo --version"
To initialize a package using cargo run the command "cargo init <packagename>"
then a folder structure is created in current directory, go into that directory. we will see a file called Cargo.toml and a src folder, In src folder main.rs file is created with default "Hello World" program
to run this run cargo run on your terminal.
Variable declaration in rust
To declare a variable we use let keyword in rust , variables are immutable in rust by default. To make it mutable we use mut keyword like this.
let my_name = "Prince Kumar"
let mut my_name = "Prince Kumar"
How to comment in rust ..
To make a comment in rust we use double forward slash (//)
For multiline comment we use notation like this /* my comment here */
Thanks