Questions tagged [brackets]

Brackets are tall punctuation marks used in matched pairs within text, to set apart or interject other text. They have a variety of meanings in different programming languages. DO NOT USE THIS for the IDE, use [adobe-brackets] instead.

Brackets are tall punctuation marks used in matched pairs within text, to set apart or interject other text. They have a variety of meanings in different programming languages.

1033 questions
270
votes
11 answers

How to select between brackets (or quotes or ...) in Vim?

I'm sure there used to be a plugin for this kinda stuff, but now that I need it, I can't seem to find it (naturally), so I'll just ask nice and simple. What is the easiest way to select between brackets, or quotes, or generally a list of matching…
Rook
  • 60,248
  • 49
  • 165
  • 242
140
votes
4 answers

Flatten list of lists

I'm having a problem with square brackets in Python. I wrote a code that produces the following output: [[180.0], [173.8], [164.2], [156.5], [147.2], [138.2]] But I would like to perform some calculations with that, but the the square brackets…
Hellfish
  • 1,685
  • 3
  • 12
  • 10
110
votes
2 answers

What does enclosing a class in angle brackets "<>" mean in TypeScript?

I am very new to TypeScript and I am loving it a lot, especially how easy it is to do OOP in Javascript. I am however stuck on trying to figure out the semantics when it comes to using angle brackets. From their docs, I have seen several examples…
davejoem
  • 4,902
  • 4
  • 22
  • 31
95
votes
16 answers

Is it ok if I omit curly braces in Java?

I've searched for this, but couldn't find an answer and for whatever reason I was too ashamed to ask professor, due to that feeling when hundreds of people stare at you... Anyhow, my question is what's the importance of having brackets? Is it OK if…
vedran
  • 2,167
  • 9
  • 29
  • 47
95
votes
6 answers

Jump to Closing tag in VS Code?

I can't seem to find a way to select the beginning of a bracket and jump to the end of it through some key combination or something in VS Code. For example, in atom, this is done with Ctrl + m. I know there is a way to jump to the beginning and end…
Ciprian Turcu
  • 1,113
  • 2
  • 8
  • 16
79
votes
6 answers

Automatic closing brackets for Vim

Is there any WORKING plugin for Vim 7.4 that would automatically close brackets ('{}', '[]', '()') and maybe insert some carriage returns (for '{}' at least)? I know this question has been asked quite a few times but none of the answers either do…
Dago
  • 1,349
  • 1
  • 11
  • 19
64
votes
3 answers

How to prevent Sublime Text 2 from swallowing closing brackets, quotes and parentheses?

Sublime has this behaviour which is really annoying sometimes when you have to type in constructions with lots of brackets. When you type ( it adds () and puts the cursor in the middle, all fine, if you however will type ) it will silently swallow…
firedev
  • 20,898
  • 20
  • 64
  • 94
56
votes
8 answers

Get the string within brackets in Python

I have a sample string , created=1324336085, description='Customer for My Test App', livemode=False> I only want the value cus_Y4o9qMEZAugtnW and NOT card (which is inside…
user993563
  • 18,601
  • 10
  • 42
  • 55
45
votes
4 answers

Different meanings of brackets in Python

I am curious, what do the 3 different brackets mean in Python programming? Not sure if I'm correct about this, but please correct me if I'm wrong: [] - Normally used for dictionaries, list items () - Used to identify params {} - I have no idea what…
jake wong
  • 4,909
  • 12
  • 42
  • 85
41
votes
4 answers

Autocomplete Method Brackets

Using: Visual Studio Pro 2013 Previous research: [1], [2], [3] I'm used to working in Java with Eclipse. My usual flow is: object. CTRL+SPACE + ENTER which autocompletes the method and places the correct curly brackets & method inputs in…
user3235057
  • 413
  • 1
  • 4
  • 5
35
votes
7 answers

PHP conditionals, brackets needed?

I was just browsing a forum and someone asked about a PHP file they had found on the web. It has several spots like this in the code: if ($REMOTE_ADDR == "") $ip = "no ip"; else $ip = getHostByAddr($REMOTE_ADDR); I have always thought brackets are…
Levi
  • 12,214
  • 14
  • 43
  • 47
34
votes
9 answers

Python parsing bracketed blocks

What would be the best way in Python to parse out chunks of text contained in matching brackets? "{ { a } { b } { { { c } } } }" should initially return: [ "{ a } { b } { { { c } } }" ] putting that as an input should return: [ "a", "b", "{ { c }…
Martin
  • 12,469
  • 13
  • 64
  • 128
32
votes
3 answers

Curly Brackets in Arrow Functions

can someone, please explain the following: I'm following Dan Abramov's lectures & doing the exercises. The code works fine, however, the tests fail when the following particular function is written with curly brackets **{ }**. case 'toggleTodo'…
Kayote
  • 14,579
  • 25
  • 85
  • 144
32
votes
7 answers

what is [] brackets in .net?

i have seen [] such brackets in c# very very rarely but when i start to learn asp.net i have seen them many times but still i couldn't understand what they does ? They are not part of code as using for arrays.For example [webmethods] which is just…
Freshblood
  • 6,285
  • 10
  • 59
  • 96
32
votes
5 answers

What is the difference between square brackets and single quotes for aliasing in SQL Server?

I have seen some people alias column names using single quotes eg: select orderID 'Order No' from orders and others use square brackets eg: select orderID [Order No] from orders I tend to use square brackets. Is there any preference/difference?
Free2Rhyme2k
  • 534
  • 1
  • 6
  • 15
1
2 3
68 69