TB RPGs Are Slightly Difficult

Posted by Taizen Chisou on March 28, 2012, 8:35 a.m.

> wake up

> "oh i know maybe i can retool the ricerca strano engine today"

oh yeah that's right i hate modifying this game

Comments

firestormx 12 years, 10 months ago

Yes. That is for small statements that don't hold much weight when analyzing code. Such as being used to catch things like:

if (number < minimum)

{number = minimum;}

I'm not saying do things like

if (number<minimum)
{
number = minimum;
//don't indent, lolol
}

Cesque 12 years, 10 months ago

Quote:
As long as you're not saying indentation should replace curly braces, it's all good. =D

I hated Python for having no curly braces but now I fucking love it.

Because if you're forced to use indentation (whether by the language itself or by "it's good practice" bullies), curly braces are completely unnecessary and a waste of two lines of visual space. I don't really see not being able to orient yourself in the code any less than when using curly braces.

I also don't get your example:

Quote:
if (colour == red)

{print red;}

else

{print blue;}

The Python code for this would be exactly as long (4 lines), except with indentation instead of curly braces.

And Python does allow you to put a number of operations in one line IIRC (not sure about if statements). It's just that nobody does it because it looks bad.

firestormx 12 years, 10 months ago

Yeah, that was a really bad example.

But curly braces do help me visualize stuff (particularly with editors brace highlighting/jump to end/etc), especially when you didn't write the code, and the code is very long and complex with a lot of nesting (my job is Quality Assurance, so I look through code).

It just makes things much more contained, for me, and minimizes the chance of mistakes.

Rob 12 years, 10 months ago

Quote: Cesque
The Python code for this would be exactly as long (4 lines), except with indentation instead of curly braces.

So would the code in other languages too…..

if (colour == red)
       printf("red");
else
       printf("blue");

That's the C/C++ version of it.

if (colour == red)
       System.out.print("red");
else
       System.out.print("blue");

…and there's the Java version… etc… etc…