Primitive Understanding

  1. What does a dot . actually do?

A dot lets you drill into an object to get a more complex action.

2. What are the curly brackets {} for?

Used to group blocks of code

3. Which is better: Allman or 1TBS?

Allman and 1TBS are both ident styles.

1TBS:

while (x == y) {
    something();
    somethingelse();
}

Allman:

while (x == y)
{
    something();
    somethingelse();
}

I don’t really have a preference between them but mostly I’ve been using 1TBS.

Edit: after doing more coding myself I definitely prefer allman as it’s much easier to understand the code when you go and reread it.

4. Why does your code has tabs in?

Tabs are four spaces. They make the code look better laid out and makes the code easier to understand and read. If the line of code is within 1 curly bracket, it will have 1 tab but if the code is within 2 curly brackets it will have 2 tabs.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s