rust array literal code example
Example: rust array literal
fn boolean_to_string(b: bool) -> String {
["false", "true"][b as usize].to_string()
}
// Note how the array (the first []) is indexed (the second []).
fn boolean_to_string(b: bool) -> String {
["false", "true"][b as usize].to_string()
}
// Note how the array (the first []) is indexed (the second []).