summaryrefslogtreecommitdiff
path: root/ex6.rs
diff options
context:
space:
mode:
authorCarol (Nichols || Goulding) <carol.nichols@gmail.com>2015-11-17 17:48:53 -0500
committerCarol (Nichols || Goulding) <carol.nichols@gmail.com>2015-11-17 17:48:53 -0500
commitf1ce5f4454be984f161c586361ed858a65357a14 (patch)
treee4d231aed4423fdb93a35032839027355d0c363d /ex6.rs
parent492c6bf594455127657103adc12b49cd4f6b5ee9 (diff)
parent802e6ac2706115935970b8c71d1ad99cb621b353 (diff)
Merge remote-tracking branch 'origin/pr/18'
Diffstat (limited to 'ex6.rs')
-rw-r--r--ex6.rs51
1 files changed, 51 insertions, 0 deletions
diff --git a/ex6.rs b/ex6.rs
new file mode 100644
index 0000000..7302a2a
--- /dev/null
+++ b/ex6.rs
@@ -0,0 +1,51 @@
+fn bigger(a: i32, b:i32) -> i32 {
+ // Complete this function to return the bigger number!
+ // Do not use:
+ // - return
+ // - another function call
+ // - additional variables
+ // Scroll down for hints.
+}
+
+fn main() {
+ assert_eq!(10, bigger(10, 8));
+ assert_eq!(42, bigger(32, 42));
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// What is Rust's equivalent of the ternary operator?
+// In C(++) this would be: a>b ? a : b
+// In Python it would be: a if a>b else b
+// If you still can't do it: Search online for rust ternary operator
+