Advertisement
AntonioVillanueva

Test si es una vocal en Rurst con matches!

Jan 24th, 2025
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.19 KB | None | 0 0
  1. //Test si es vocal en Rust con matches!
  2.  
  3. fn vocal (c:char)->bool{
  4.     matches! (c,'a'|'e'|'i'|'o'|'u')
  5. }
  6.  
  7. fn main (){
  8.    
  9.     for n in 'a'..='z'{
  10.         println!("{} => {}",n,vocal(n) )
  11.     }
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement