Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Commit 4adb605

Browse files
committed
fizzbuzz example error with strings
1 parent 2d4cdc2 commit 4adb605

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

presentations/intro-to-rust/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,21 @@
915915
---
916916
class: middle, left
917917

918+
## A common problem
919+
920+
```rust
921+
fn fizz(num: u32) -> String {
922+
if num % 3 == 0 {
923+
"Fizz".to_string() // <-- convert "Fizz" into a string
924+
} else {
925+
num.to_string()
926+
}
927+
}
928+
```
929+
930+
---
931+
class: middle, left
932+
918933
## Slices
919934

920935
* A view into some data

0 commit comments

Comments
 (0)