0
Why my output is always 0?
The method “show” needs to show how many vowels are in the array, but i always get 0. How can i solve this? https://code.sololearn.com/caK1V1WjL49P/?ref=app
3 Réponses
+ 3
From a quick glance, the variable cont is reconstructed each time the function show() is called (in other words, cont is unique to each stack frame). So you'd have to store the result of show() into cont and then return it when the first condition is no longer met.
Edit:
Simplified parts of it: https://code.sololearn.com/ca1392a24A2A
+ 1
hey Diego Becerril
that is because you are returing the varible cont which has a value of zero and you are returning cont so no matter the result of the if and switch statements it will always return zero
0
Jegix thaaaanks, your code its helpfull