search results matching tag: braces

» channel: learn

go advanced with your query
Search took 0.000 seconds

    Videos (69)     Sift Talk (4)     Blogs (3)     Comments (199)   

Is Trump Under Investigation? He and His Lawyers Disagree

Tabs v(ersu)s Spaces from Silicon Valley S3E6

MilkmanDan says...

(**EDIT** hmm, code HTML tag doesn't seem to allow whitespace to show at the beginning of lines, so I'm replacing spaces with _underscores_ in the pseudocode below)

Code uses spaces or tabs to visually distinguish the flow of the program, what code belongs to what functions / loops / whatever.

Here's some C-style "pseudocode" that should get the idea across:

void function fizzbuzz {
__for (i = 1; i <= 100; i++) {
____set print_number to true;
____If i is divisible by 3
______print "Fizz";
______set print_number to false;
____If i is divisible by 5
______print "Buzz";
______set print_number to false;
____If print_number, print i;
____print a newline;
__}
}


The braces { } show the beginning and ending of a "function" (essentially one of potentially many self-contained algorithms in a program) and the beginning and ending of a "for loop" (that will repeat the code inside it some number of times). And the "if" statements will only perform the stuff after them IF the test they perform evaluates to true.

So in that pseudocode, there's sort of 4 tiers or things going on. First is the function (named "fizzbuzz"). Since functions are kind of the most basic structural unit of the code, they are on the far left -- not indented at all. Sorta like Roman Numerals in an outline.

Then, the actual content of that function (the code that makes up its algorithm) is set a consistent amount of space to the right to make it clear that it is contained inside the function. That can be done with *1* tab, or some consistent amount of spaces so that it lines up. The only thing in that tier is the "for loop" and the braces that show its beginning and end.

Then the content of the for loop is set a bit further to the right (with another space or another set number of spaces). All of the "if" statements are at that 3rd tier level, along with a bit more code at the beginning and end. Then, the actual content of the if statements is set one more tier to the right to help distinguish that it will only run IF the conditions are met.

That pseudocode uses spaces for all of the tiering -- 2 spaces per tier. I'm a tab person like the guy Richard in the video, because it seems easier to press tab once per tier than hitting the spacebar 2/3/4 times per tier. But it really is just a personal preference issue, because as he said in the video, by the time the code is compiled (turned into an executable file that the computer can run) the final result will be the same whether the programmer used spaces or tabs.

But like with many things, Silicon Valley really hits the nail on the head here. Programmers tend to be very set in their ways and anal about their style preferences for code. If we have to go through someone else's code that doesn't follow our style conventions exactly, it kinda tends to throw us out of whack. To make an analogy with something less nerdy, consider how annoying it can be when someone borrows your car and you have to adjust the seat / mirrors / radio stations etc. when you get back in.

eric3579 said:

Don't think i've ever used a tab outside filling in a form or playing video games. Does the tab thing have more to do with writing code?

Huge Indy 500 crash

Pipe Cutting Mistake

ulysses1904 says...

Reminds me of when I was helping my neighbor cut branches. He was at the top of an extended ladder that was leaning against the branch he was chainsawing, about 20 feet up. I'm bracing the ladder and I realize once he cuts off the outer part of that branch the remaining part is going to be a whole lot lighter, and the ladder won't be leaning against it anymore. He was grateful I brought it to his attention, to say the least.

That is NOT going to rub out

BLIP

Can We Get Some Awwww Up In Here?

hazmat22 says...

@1:17 it sort of looks like he has a brace or maybe even a prosthetic leg.

I instantly pictured that the lion ate his leg once but they patched up the relationship, forgave each other and maybe the 4 weiner dogs are just a little safety buffer in case?

Mandela Effect | Braces MISSING From Dolly in Moonraker 1979

TheFreak says...

I remember Dolly having braces and not having braces. I remember the Berenstein bears and the Berenstain bears. I remember the FBI agents in E.T. having guns and I remember them holding radios. I remember the sky blazing away and the mountains melting and all life turning to ash as the sun expanded and consumed the earth. I remember the great obelisk in the sky...and not in the sky...as the seas boiled and did not.

I am not pan-dimensional.
I am not omni-universal.
I am not immortal.
I am inevitable.

Or really, really not paying close attention to my surroundings. Whatever.

Mandela Effect | Braces MISSING From Dolly in Moonraker 1979

artician says...

I remember the braces. I had braces at the time. I remember this scene very clearly.

This is the first I've heard of this. I read all the Berenstein Bears books as well. Definitely with the EIN. What in the holy hell...

Mandela Effect | Braces MISSING From Dolly in Moonraker 1979

Mordhaus says...

I would be more willing to bet that the film version had them and the later home versions had a different cut of the film. I've had this happen before when I went to early showings of a film and then later they change something on the video release.

The first I can recall this happening on was the movie "Hocus Pocus". I watched it for free when it came out, but I didn't realize it was one of those test screening things. There were several scenes that were different from when I watched it later on VHS with my wife. It came to me later that the test screening I watched had most of the cut scenes that were in the trailer and that later never made it to the final version.

You can even see this more recently in Suicide Squad. Several scenes from the various trailers never showed up in the movie itself. When I watched it, I kept wondering what the hell was going on. Some of the scenes even would have been better had they been left in.

In any case, it's odd and like the video says, it's clearly meant to be assumed she had braces. The scene doesn't work the same any other way. However, I never watched the theater version of Moonraker, so I can't be sure. I never really liked Moore's bond that much.

Wedding Knockout with UFC Commentary

xxovercastxx says...

Why do people always try to yank someone who's taken a hit like that back up to their feet?

The ground is a perfectly good place for someone who can't stand up to be. Leave her down there. Talk to her to see if she's coherent. Gradually work your way to sitting up. After several minutes, try standing her up and brace her until you're sure she's steady.

And then go to the fucking hospital anyway.

How to survive in a free falling elevator

Jinx says...

...but you wouldn't be able to stack anything in a falling elevator.

Also, forget internal organs. Well, not completely, but having them mostly intact isn't going to help you much if your the fall has driven your femur up through your pelvis and made a proper mess of some rather important arteries. My procedure for nightmare-falling-in-elevator-scenario is a) protect head with arms - adopt the brace position b) Lie as flat as possible to avoid aforementioned projectile leg bones c) get as close to the floor of the lift as possible.

but yeah, you're probably fucked.

Marvel's Ant-Man - Trailer 1

EMPIRE says...

Well, brace yourself, because there's a LOT of them still coming.

Marvel:
Fantastic Four (again... again)
Deadpool
Gambit
Doctor Strange
Black Panther
Inhumans
Captain Marvel

DC:
Suicide Squad
Wonder Woman
The Flash
Aquaman
Shazam


And all this... in the next 5 years.

As a comic book fan... yay!

Morris Day and the HAIM - "Jungle Love"

SFOGuy says...

lol.
LA Girl group, sisters with the last name of "Haim" (In case the Google on your computer is broken).
Thought in some circles to have a sound which captures features of (brace yourself)---Fleetwood Mac...

Mystic95Z said:

"The Haim" == "Them HO's" to his left?

*backup=[...snipped...]? (Wtf Talk Post)

lucky760 says...

This was a desperately desired change by at least one sifter who was sick of seeing a whole comment with a whole video within the *backup=[] braces who would always go in and edit to remove the embed manually.

In short, it cleans up the comment listing and removes content that's not really necessary because either it's still in the list of backups on the video or it has been used to replace the video.



Send this Article to a Friend



Separate multiple emails with a comma (,); limit 5 recipients






Your email has been sent successfully!

Manage this Video in Your Playlists

Beggar's Canyon