Pure Programmer
Blue Matrix


Cluster Map

Project: Alouette Lyrics

Compute the full lyrics to the song Alouette. Write a function to print a verse given the verse number. Write another function to print the refrain. Your main() method should then loop through all the verses calling the verse function for each verse.

See [[Alouette (song)]]

Output
$ rustc AlouetteLyrics.rs error[E0277]: the type `[&'static str]` cannot be indexed by `isize` --> AlouetteLyrics.rs:18:41 | 18 | println!("Je te plumerai {}.", phrases[num - 1]); | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[&'static str]>` is not implemented for `isize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` = note: required for `Vec<&'static str>` to implement `Index<isize>` error[E0277]: the type `[&'static str]` cannot be indexed by `isize` --> AlouetteLyrics.rs:19:41 | 19 | println!("Je te plumerai {}.", phrases[num - 1]); | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[&'static str]>` is not implemented for `isize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` = note: required for `Vec<&'static str>` to implement `Index<isize>` error[E0277]: the type `[&'static str]` cannot be indexed by `isize` --> AlouetteLyrics.rs:23:38 | 23 | println!("Et {}! Et {}!", phrases[i], phrases[i]); | ^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[&'static str]>` is not implemented for `isize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` = note: required for `Vec<&'static str>` to implement `Index<isize>` error[E0277]: the type `[&'static str]` cannot be indexed by `isize` --> AlouetteLyrics.rs:23:50 | 23 | println!("Et {}! Et {}!", phrases[i], phrases[i]); | ^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[&'static str]>` is not implemented for `isize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` = note: required for `Vec<&'static str>` to implement `Index<isize>` error[E0308]: mismatched types --> AlouetteLyrics.rs:36:14 | 36 | while i <= phrases.len() { | - ^^^^^^^^^^^^^ expected `isize`, found `usize` | | | expected because this is `isize` | help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit | 36 | while i <= phrases.len().try_into().unwrap() { | ++++++++++++++++++++ error: aborting due to 5 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`.

Solution