010
This commit is contained in:
13
get_count.v
Normal file
13
get_count.v
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
fn get_count(str string) int {
|
||||||
|
mut count := 0
|
||||||
|
for r in 0 .. str.len {
|
||||||
|
if str[r] == `a` || str[r] == `e` || str[r] == `i` || str[r] == `o` || str[r] == `u` {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println(get_count('hello'))
|
||||||
|
}
|
Reference in New Issue
Block a user