code edicute - proper structor or gudelines

edited May 2014 in General Discussion

Hello and I am new to all of this. I have been only on Khan Academy for a month and know that they are about processing.js and this is Processing. I am two days into Daniel Shiffmans book "Learning Processing a Beginners Guide..." I noticed in some his examples he leaves no spaces between the comas and the objectives//arguments in the function (); Is this OK?? I realize it does not effect the code when it it run. In Khan and W3 as well as others I have seen this also. Then I heard in a instructional video it is a must because this practice assure`s a common place or common practice when working in between languages. I am JUST VERY NEW and don't want to want to have bad habits on top of being confused and stumbling around. For something that has so many "stricked" things to follow that will produce errors. Is this looseness OK?? Or is there a set guideline to format the lines of code in the editor??? Please help and it just bugs me and don't want to start off with any bad habits or "laziness".

Answers

  • PRO 3 This is what I mean.

  • edited May 2014 Answer ✓

    By convention, for functions/methods, names are next to their parens w/o any spaces between them: function(). :-B
    On the other hand, when it's a language keyword, like if, for, while, do, switch, catch, synchronize, etc.,
    a space is placed between that and its parens: if (), switch (), etc., in order to differentiate them
    from their regular function/method counterparts! :P

  • edited May 2014 Answer ✓

    ... no spaces between the comas...

    We do use 1 space after each comma! [-(

    P.S.: We can hit CTRL+T inside Processing's IDE in order to format our code.
    Sometimes that can make miracles! ;;)

  • Thanks for replying and I thought so but I am very new to all this. I was getting info on HTMLs and it was mentioned not get sloppy or cut corners. Especially starting out and I see this by the author and was not sure if it was proper or the way "this" language is written it was OK. Thanks for your time and the express key, ALL HELP IS A BLESSING!!...Peace.....

Sign In or Register to comment.