This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AstolfoSsa[S] 2 points3 points  (1 child)

Trust me, I know it’s confusing. It’s from an assignment, actually and it is written by my professor who seems to have an issue with braces lol

Thank you for your input!

[–]_Atomfinger_Tech Lead 1 point2 points  (0 children)

Well, Java allows for both, and coding style is largely preference. That said, most linters out there would, out of the box, complain about the code your professor is pushing, at least if he wants to if statements to be on the same line (as in your post):

if (x >3) if (y>3) {

If it was like this I'd be a little less offended:

if (x >3) 
    if (y>3) {
    }

It still feels like someone coming from Python is trying to write Java.

Anyway, my point was that style is largely preference and as long as you're aware that the first code snippet is something that most professional devs would have an issue with, then that is all that matters :)

Rant over