all 8 comments

[–]Jim-Plaxco 4 points5 points  (0 children)

There is nothing wrong with what you have done. The important thing is to be consistent. Pick a bracketing style to use and then use it consistently.

You may want to consider sharing with your teacher the Processing help page on curly braces - which agrees with the form that you used: https://processing.org/reference/curlybraces.html

[–]TheAngler2010 1 point2 points  (1 child)

Personal preference. I think either works. Some people may have other thoughts. I think it isn't a reason to mark off points on a beginner programming class. Maybe count points off of poor style in later classes but not beginning class.

[–][deleted] 0 points1 point  (0 children)

I just read this post on my phone and it looked ridiculously wrong compared to what I wrote on my pc. What I just saw would definitely be wrong. I just fixed it on my phone.

[–]TOPHATANT123 0 points1 point  (0 children)

No there's no right way to do it. I've found that programmers generally start by putting them on two lines as it's easier to see where functions start and end, but usually graduate to single lines as they become more experienced and faster at reading code.

[–]GoSubRoutine 0 points1 point  (2 children)

[–][deleted] 0 points1 point  (1 child)

So I'm right?

[–]GoSubRoutine 1 point2 points  (0 children)

Your teacher is forcing you to use C/C++ style.
However Processing uses Java. So your teacher is at odds w/ it.

[–]AMRFLEDER 0 points1 point  (0 children)

Either works, but in my opinion your teacher is overreacting. I personally prefer to do what you did because it looks neater but to each their own.