commit bc133dc11e9c330df87388787043ec742b16c184 Author: Eduardo Cueto Mendoza Date: Thu Jul 16 22:01:23 2020 -0600 Fisrt commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..a2484c1 --- /dev/null +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..64b161f --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "hello_world" +version = "0.1.0" +authors = ["Eduardo Cueto Mendoza "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..48e9393 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,9 @@ +//mod print; +//mod vars; +mod types; + +fn main() { + //print::run(); + //vars::run(); + types::run(); +} diff --git a/src/print.rs b/src/print.rs new file mode 100644 index 0000000..b8da9e0 --- /dev/null +++ b/src/print.rs @@ -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); +} \ No newline at end of file diff --git a/src/types.rs b/src/types.rs new file mode 100644 index 0000000..0df6e4a --- /dev/null +++ b/src/types.rs @@ -0,0 +1 @@ +pub fn run() {} \ No newline at end of file diff --git a/src/vars.rs b/src/vars.rs new file mode 100644 index 0000000..e864404 --- /dev/null +++ b/src/vars.rs @@ -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); +} \ No newline at end of file