Prototypes & Examples in part index.md #7

Closed
opened 2025-03-12 19:55:19 +00:00 by owochle · 0 comments

```prototype
/// Add the last two numbers of the input slice.
///
/// If the slice is not large enough, return `None`
/// If it is, return the computed value in a `Some`
pub fn add_last_two(v: &[f32]) -> Option<f32> {
unimplemented!()
}
```
```example
fn main() {
assert_eq!(add_last_two(&[]), None);
assert_eq!(add_last_two(&[10.0]), None);
assert_eq!(add_last_two(&[1.0, 2.0, 3.0]), Some(5.0));
}
```

https://gitea.lilymonade.fr/lilymonade/exowos/src/commit/c52caca8449c5fa0a83bcca522f7f31370166623/subject_text/vec/index.md?display=source#L17-L33
lilymonade referenced this issue from a commit 2025-03-14 22:13:54 +00:00
Sign in to join this conversation.
No Label
No Milestone
No project
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lilymonade/exowos#7
No description provided.