Beer Song
概要
初期コード
pub fn verse(n: u32) -> String {}
pub fn sing(start: u32, end: u32) -> String {}考察
- 0,1,2, _ で分岐させる。match式を使う
学んだこと
- mapの使い方 各iteratorを引数にする場合はそのまま使うことができる
num_str.chars.filter_map(|c| c.to_digit(10)).map(func)pub fn verse(n: u32) -> String {}
pub fn sing(start: u32, end: u32) -> String {}num_str.chars.filter_map(|c| c.to_digit(10)).map(func)