Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- )
- func main() {
- text := `The quick brown fox jumps over the lazy dog`
- vowels, spaces, constants := 0, 0, 0
- for _, char := range text {
- switch char {
- case 'a', 'e', 'i', 'o', 'u':
- vowels++
- case ' ':
- spaces++
- default:
- constants++
- }
- }
- fmt.Printf("Found %d vowels, %d spaces and %d constants", vowels, spaces, constants)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement