projects
/
rust-101.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make the gray background go all the way to the right
[rust-101.git]
/
workspace
/
src
/
part01.rs
diff --git
a/workspace/src/part01.rs
b/workspace/src/part01.rs
index ed6717ca3b8111f7b61afc56f0b863c6f3fffc73..be2c2d261c85bb18c73a7fda54f1abdae59aed2f 100644
(file)
--- a/
workspace/src/part01.rs
+++ b/
workspace/src/part01.rs
@@
-8,7
+8,7
@@
// ## Expression-based programming
fn sqr(i: i32) -> i32 { i * i }
// ## Expression-based programming
fn sqr(i: i32) -> i32 { i * i }
-// Conditionals are also just expressions.
You can compare this
to the ternary `? :` operator
+// Conditionals are also just expressions.
This is comparable
to the ternary `? :` operator
// from languages like C.
fn abs(i: i32) -> i32 { if i >= 0 { i } else { -i } }
// from languages like C.
fn abs(i: i32) -> i32 { if i >= 0 { i } else { -i } }
@@
-68,7
+68,7
@@
pub fn main() {
// You will have to replace `part00` by `part01` in the `main` function in
// `main.rs` to run this code.
// You will have to replace `part00` by `part01` in the `main` function in
// `main.rs` to run this code.
-// **Exercise 01.1**: Write a funtion `vec_sum` that computes the sum of all values of a `Vec<i32>`.
+// **Exercise 01.1**: Write a fun
c
tion `vec_sum` that computes the sum of all values of a `Vec<i32>`.
// **Exercise 01.2**: Write a function `vec_print` that takes a vector and prints all its elements.
// **Exercise 01.2**: Write a function `vec_print` that takes a vector and prints all its elements.