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
16
votes
2 answers

difference between dot notation and bracket notation in javascript

I am trying to understand the difference between .Notation and [] notation. In my problem below when I use if (object[key] === true) I get the correct answer. When I use if (object.key === true) it does not work. Could someone explain why it's…
jstone
  • 435
  • 3
  • 8
  • 18
14
votes
3 answers

Auto complete brackets in Mathematica

Not a long ago I started to learn Mathematica - i.e. I'm novice. Usually I code in text editors with auto close of brackets like Gedit,Notepad++,Qt IDE etc. It's very convenient when you are not obliged to watch over brackets. But my attempts to…
Tebe
  • 3,176
  • 8
  • 40
  • 60
14
votes
8 answers

Two square bracket overloading

I am writing a matrix class in c++ and trying to overload some operator like = and >> and << etc. I was unable to overload operator [][] for matrix class. if i have an object of class matrix like M1 then i can use this way for giving value to each…
fafa
  • 539
  • 2
  • 7
  • 8
13
votes
1 answer

Can I use Perl regular expressions to match balanced text?

I would like to match text enclosed in brackets etc in Perl. How can I do that? This is a question from the official perlfaq. We're importing the perlfaq to Stack Overflow.
perlfaq
  • 1,361
  • 4
  • 15
  • 23
11
votes
2 answers

What is the meaning of angle brackets in Python?

I found the following lines in the scikit-learn package: if is_sparse: problem = csr_set_problem( (X.data).data, (X.indices).shape, …
user1717828
  • 7,122
  • 8
  • 34
  • 59
11
votes
9 answers

Why I don't need brackets for loop and if statement

I don't understand why I don't need brackets in this case for (int i = 0; i < 10; i++) if (num[i] < min) min = num[i]; And why I need brackets in this case int num[10], min; for (int i = 0; i < 10; i++) { cout << "enter 10…
princearthur791
  • 173
  • 1
  • 1
  • 7
11
votes
33 answers

Codility : Brackets Determine whether a given string of parentheses is properly nested

Problem description from codility : A string S consisting of N characters is considered to be properly nested if any of the following conditions is true: S is empty; S has the form "(U)" or "[U]" or "{U}" where U is a properly nested string; S has…
klind
  • 855
  • 2
  • 21
  • 33
11
votes
1 answer

what do the square brackets mean? in Java

What does it mean when there are square brackets in front of double. For example double[]? Is there any special way to use the return function when using them in a method. For example: public double[] MethodName(){ } What is the type of the return…
10
votes
8 answers

Ruby - Regex for matching brackets?

I am trying to figure out if a string has properly closed brackets. To do this, I use the following three bracket pairs. [] () {} The brackets may also be nested as long as they're formatted properly. )([]{} - Does not have properly closed brackets…
Johnson
  • 1,679
  • 1
  • 14
  • 21
10
votes
1 answer

Angled brackets in Maven console output

Looking at the picture below, I noticed that Maven sometimes prints 3 angled brackets (">>>" or "<<<") when invoking particular goals. What do these angled brackets mean? All other goal invocations are preceded by 3 hyphens ("---"). My guess is…
spg
  • 9,309
  • 4
  • 36
  • 41
9
votes
1 answer

Python logging: left align with brackets

I would like to format the logger with brackets and left-align the text. formatter = logging.Formatter('[%(asctime)s] [%(levelname)-8s] [%(funcName)-12s] %(message)s') Here is the result [2019-09-13 16:22:56,050] [INFO ] [main ] …
cogimi
  • 109
  • 1
  • 2
9
votes
1 answer

Confusing Angle Brackets < something > in c++

I am coming from c to c++ and familiar with the syntax. But I just came across the code with syntax im not familiar with int main() { std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); …
gfdsal
  • 651
  • 1
  • 8
  • 25
9
votes
3 answers

php regex to detect text inside brackets ignoring nested brackets

I'm trying to make a php regex work that parses a string for text in brackets while ignoring possible nested brackets: Let's say I want Lorem ipsum [1. dolor sit amet, [consectetuer adipiscing] elit.]. Aenean commodo ligula eget dolor.[2. Dolor,…
hm711
  • 168
  • 8
9
votes
1 answer

What is this JavaScript construct: " = [y for each ...]"

myColl.y = [y for each (y in myColl.y) if (y != myThing.getY())]; I understand what this is doing, returning all the 'y' items that are not the current one... But, what is the concept called here with the brackets? I would like to read up on what…
Scott Szretter
  • 3,938
  • 11
  • 57
  • 76
9
votes
5 answers

Syntax error on token ";", { expected after this token in Random string creator

I am writing code to generate a random 3 letter strings using the letters a, b, and c. I am getting the error message "Syntax error on token ";", { expected after this token" after the line where i create the random variable (Random rand = new…
user2615699
1 2
3
68 69