Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

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 []).
 
PREVIOUS NEXT
Tagged: #rust #array #literal
ADD COMMENT
Topic
Name
8+8 =