Fisrt commit
This commit is contained in:
commit
bc133dc11e
|
@ -0,0 +1 @@
|
|||
/target
|
|
@ -0,0 +1,5 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "hello_world"
|
||||
version = "0.1.0"
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "hello_world"
|
||||
version = "0.1.0"
|
||||
authors = ["Eduardo Cueto Mendoza <cueto303@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -0,0 +1,9 @@
|
|||
//mod print;
|
||||
//mod vars;
|
||||
mod types;
|
||||
|
||||
fn main() {
|
||||
//print::run();
|
||||
//vars::run();
|
||||
types::run();
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
pub fn run() {
|
||||
// print to console
|
||||
println!("Hello from the print.rs file");
|
||||
|
||||
// Basic formatting
|
||||
println!("Number: {}",1);
|
||||
println!("{} is from {}", "Brad", "Mass");
|
||||
|
||||
// Positional Arguments
|
||||
println!("{0} is from {1} and {0} likes to {2}", "Brad", "Mass", "code");
|
||||
|
||||
// Named arguments
|
||||
println!(
|
||||
"{name} likes to play {activity}",
|
||||
name="John",
|
||||
activity="baseball"
|
||||
);
|
||||
|
||||
// Placeholder traits
|
||||
println!("Binary: {:b} Hex: {:x} Octal: {:o}", 10,10,10);
|
||||
|
||||
// Placeholder for debug trait
|
||||
print!("{:?}", (12,true,"hello"));
|
||||
|
||||
// Basic math
|
||||
print!("10 + 10 = {}", 10 + 10);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
pub fn run() {}
|
|
@ -0,0 +1,15 @@
|
|||
pub fn run() {
|
||||
let name = "Brad";
|
||||
let mut age = 37;
|
||||
println!("My name is {} and I am {}", name, age);
|
||||
age = 38;
|
||||
println!("My name is {} and I am {}", name, age);
|
||||
|
||||
// Define constant
|
||||
const ID: i32 = 001;
|
||||
println!("ID: {}", ID);
|
||||
|
||||
// Assign multiple vars
|
||||
let ( my_name, my_age ) = ("Brad", 37);
|
||||
println!("{} is {}", my_name, my_age);
|
||||
}
|
Loading…
Reference in New Issue