summaryrefslogtreecommitdiff
path: root/rust/branches
diff options
context:
space:
mode:
Diffstat (limited to 'rust/branches')
-rw-r--r--rust/branches/Cargo.lock7
-rw-r--r--rust/branches/Cargo.toml8
-rw-r--r--rust/branches/src/main.rs26
3 files changed, 41 insertions, 0 deletions
diff --git a/rust/branches/Cargo.lock b/rust/branches/Cargo.lock
new file mode 100644
index 0000000..b420e22
--- /dev/null
+++ b/rust/branches/Cargo.lock
@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "branches"
+version = "0.1.0"
diff --git a/rust/branches/Cargo.toml b/rust/branches/Cargo.toml
new file mode 100644
index 0000000..6934aa4
--- /dev/null
+++ b/rust/branches/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "branches"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/rust/branches/src/main.rs b/rust/branches/src/main.rs
new file mode 100644
index 0000000..450f526
--- /dev/null
+++ b/rust/branches/src/main.rs
@@ -0,0 +1,26 @@
+fn main() {
+ let number = 6;
+
+ if number < 5 {
+ println!("condition was true");
+ } else {
+ println!("condition was false");
+ }
+
+ if number % 4 == 0 {
+ println!("Divisible by 4");
+ } else if number % 3 == 0 {
+ println!("Divisible by 3");
+ } else if number % 2 ==0 {
+ println!("Divisible by 2");
+ } else {
+ println!("Shit hit the fan");
+ }
+
+ let condition =true;
+ let x = if condition { 5 } else { 6 };
+ println!("The value of number is: {x}");
+
+ // This code Kabooms
+ // let foo = if condition { 6 } else { "seven" };
+}