How do you write code?
A:
if (this==statement) {
code = 1;
if (this==another) {
moar = 2;
}
}
B:
if (this == statement)
{
code = 1;
if (this == another)
{
moar = 2;
}
}
C:
if (this == statement)
{
code = 1;
if (this == another)
{
moar = 2;
}
}
Notice I put semicolons after every assignment, because it is good practice.
I also put "==", even though this isnt required in game maker, its required in other languages. Probably because you can assign variables within statements in other languages.
Personally I code in A, but i think the most legible and widely used is B.
What would be cool is if there was an option in game maker to clean their code up to standards, for learning purposes.
In other news, YOYOgames is starting to go bankrupt. Which i find hallarious.
heres the link:
yoyogames
I used to code in A all the time, and some IDEs consider that default (when you create a new file with content). Unity comes to mind. But right now I code in B, because it does feel the most legible to me.
Also, GM was better when Mark ran the show.I always use C, but in a different way:
I don't use GM anymore, but my C++/Java style of choice is:
^that's how I write
A.
I slam my head on the keyboard. I generally write like B but I'm prone to being messy when I have to add something extra.
@Iasper: Thats not good practice at all :( Youre missing semi-colons, parenthesis, and indentation. I recommend picking up on A or B if youd like to continue programming, as it is a standard. Try it out!
@ludamad: Yeah im starting to pick up on that as well. Indentation after a statement clause is much easier to follow.I like to code everything like so:
I like the brevity of method A, but enjoy the nostalgia and readability of method B.
I used to write code completely like method B, stemming from my background in Game Maker, however in recent years have had to use method A due to conformity with existing project coding styles. Since then I have been impartial to either method.My choice would be to go with whatever the standard is for the particular language or project, since consistency is paramount.I prefer B over A.
But honestly as long as it's not C it's okay.