I am a beginner in programming and I need some help! I have these for-loops and if statements, how could I shorten the code?
`for (int i = 0; i < Sentence.length(); i++) {
if (Sentence.charAt(i) != ' ') {
totalNumberOfCharaters++;
}
}
for (int i = 0; i < Sentence.length(); i++) {
if (Sentence.charAt(i) == symbolInput.charAt(i) ) {
numberOfSymbols++;
}
}`
Aucun commentaire:
Enregistrer un commentaire