My OLD Syntax

Started by
79 comments, last by 21st Century Moose 10 years, 5 months ago

The real WTF is that on my keyboard only 2 of the conditions can possibly be true at any one time.

Keyboard ghosting, FTW.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Advertisement

Syntax aside, what's actually concerning about the OP's before and after code, is that they're tying input processing directly to logic. Its well-enough for prototypes or small things, but it's probably gonna break-down right around the time you want to make the character jump, or do any kind of animation.

Be ye character? Or cursor?

throw table_exception("(? ???)? ? ???");

If I'm going to use curly braces, then I want the open and closed characters nicely lined up vertically. Makes things nice and neat by grouping things in blocks.

But personally I just use Python these days and ignore these debates.

Old Username: Talroth
If your signature on a web forum takes up more space than your average post, then you are doing things wrong.

If I'm going to use curly braces, then I want the open and closed characters nicely lined up vertically. Makes things nice and neat by grouping things in blocks.

Well, if you insist:


if (keyboard_check(vk_left)) {
     x -= 5;
                             }

if (keyboard_check(vk_right)) {
     x += 5;
                              }

if (keyboard_check(vk_up)) {
     y -= 5;
                           }

if (keyboard_check(vk_down)) {
     y += 5;
                             }

laugh.png

If I'm going to use curly braces, then I want the open and closed characters nicely lined up vertically. Makes things nice and neat by grouping things in blocks.

Well, if you insist:


if (keyboard_check(vk_left)) {
     x -= 5;
                             }

if (keyboard_check(vk_right)) {
     x += 5;
                              }

if (keyboard_check(vk_up)) {
     y -= 5;
                           }

if (keyboard_check(vk_down)) {
     y += 5;
                             }

laugh.png

You're wasting vertical space ... this is much better :D


if (keyboard_check(vk_left)) {
        x -= 5;              }
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

The OP code is not much different, however I find that


if (!something)
{
do stuff;
}

is a lot harder to read when I have a nest that is 5+ deep.

I personally prefer


if (!something){
do stuff;
}

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

If you have a nesting that deep probably the issue is the excessive nesting... (easier said than done, since this is not just a coding style issue, it's a programming issue as it's directly tied to the code structure)

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

I swear we had a programming style's discussion/argument not less than a month ago. will it never end?!

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

If you have a nesting that deep probably the issue is the excessive nesting... (easier said than done, since this is not just a coding style issue, it's a programming issue as it's directly tied to the code structure)

Hmm, let me dig around and see if I can find one of my "overly nested" projects . ( LSL is a nightmare for nests, however I do not believe I have any examples in that language left . )

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

I say we paint it blue smile.png

This topic is closed to new replies.

Advertisement