Questions tagged [square-bracket]

The symbols "[" and "]", commonly used in programming languages. Please use this tag only if the specific usage of these symbols is a relevant part of the question.

Overview

The square brackets "[" and "]" are special cases of brackets, along with parentheses and curly brackets (or braces) ("{", "}").

Uses

Square brackets have many uses in most programming languages, such as:

279 questions
-1
votes
1 answer

extJS - when-to & when-not to use square brackets

i have been learning extJS, and i could cram it up but i want to understand... in the following cases we use square brackets, if not it gives error require : ['Ext.container.Viewport'] controllers : ['Users','List'] but in these we…
Moon
  • 19,518
  • 56
  • 138
  • 200
-2
votes
2 answers

Meaning of two double brackets ([][]) in Java

What is the role of a pair of double brackets ([][]) in Java? reference code(Leetcode 1351. Count Negative Numbers in a Sorted Matrix): class Solution { public int countNegatives(int[][] grid) { final int m = grid.length; final int n =…
-2
votes
3 answers

How does this overloading of square brackets work

I want to avoid printing space (" ") or an underscore ("_") after the last element of an array while printing them using a for loop. The problem mentions one of the way to do so, I want to understand how and why this happens. vector v1 =…
-2
votes
1 answer

Square brackets problem in GET form method

I'm working on a form in my aaa.php file, with checkboxes using square brackets in the "name" parameter :
The form…
-2
votes
1 answer

Error reading JSON file containing square brackets in Python

I need to modify the values of a JSON file that is being used by another program. It looks like this: [ { "ENABLED": "True", "NAME": "Cage", "CODE": "3928273", "COLOR": "Green" } ] This causes my script (below) to throw errors. It works…
jedi2191
  • 11
  • 1
  • 1
-2
votes
1 answer

I'm just wondering if anyone could clarify why Square Brackets are being used during a Function call-back in JavaScript?

So, I'm currently working my way through JavaScript and often find myself getting the 'information overload' block regarding information... I was hoping someone could clarify for me that why, if I write the below Function, upon its call-back I…
Mike
  • 1
-2
votes
1 answer

overload square bracket operator with private nested class

I want to overload the square bracket operator [] using a private nested class to differentiate between v[i] = val and val = v[i]
-3
votes
1 answer

What does this for loop with undefined terms inside brackets mean in python?

I have a mathematics code in python and need to convert it to java. But I can't konw how to work this: #python source sum([d**2 for d in (x - y)]) x,y are arrays and defined and have value. I have trouble with the for loop and the connexion with…
-6
votes
3 answers

Perl: Meaning of double squared brackets after a string?

I don't understand a seemingly basic piece of code in Perl, which looks like this: $line[$k][1] What is the meaning of the double squared brackets? I'm sorry if this was already asked or is so basic it can be found in every beginners book for Perl.…
1 2 3
18
19