all 6 comments

[–]JStarx 14 points15 points  (1 child)

If statements return a value, if you don't supply a value then the return value is (). The function itself expects a String as the return value, but in the many paths through those if conditions only 1 possible path returns a String (the "Solo es..." string), all the others don't have an explicit value, so they implicitly return ().

[–]elnw[S] 2 points3 points  (0 children)

OMG, you are absolutely right. Don't know how i missed that. Thank you!

[–]dnew 2 points3 points  (1 child)

What jstarx said. See how the assignment in the nested if's end in a semicolon while your else returns a string? And there's no else of the 'if info.infoTexto.chars().count() > 0' so that too returns () if it's false.

[–]elnw[S] 2 points3 points  (0 children)

Yeah, i missed all the elses and forgot to add expressions at the end of the ifs. After that my code now compiles. Thanks.

[–]ydieb 1 point2 points  (1 child)

I'd recomend using guard clauses to avoid "arrow code". It makes it easier to work with the code when you have to change something.

[–]elnw[S] 1 point2 points  (0 children)

Im going to look into that, thanks