Questions tagged [curly-brackets]

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.

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

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

  • identify code blocks;
  • create lists and arrays;
  • pass arguments to commands in TeX.
82 questions
0
votes
2 answers

Scalars in Perl - Can they be exported throughout the script

Not sure how clear my title is, but im new to perl and had no other way to really describe it. What I'm trying to do is something like this: if(condition){ my $VAR = " "; } Then later use $VAR somewhere else... if(! $USR){ my $USR =…
Nick Hatfield
  • 315
  • 2
  • 11
0
votes
2 answers

execute commands with curly brackets on bash

I would like to know why the following command is not working in Bash and how it's possible to make it run: /etc/init.d/{httpd,nscd} status Thanks
Anastasios Andronidis
  • 6,310
  • 4
  • 30
  • 53
0
votes
3 answers

Usability of Curly Brackets

Say I have the following code below that only uses 2 curly brackets: public void listFish(){ System.out.println(name + " with " + numFishCaught + " fish as follows: "); for (Fish f: fishCaught) if (f != null) …
Michel Tamer
  • 341
  • 1
  • 3
  • 10
0
votes
4 answers

Having an issue with curly brackets in Processing

My code returns an error when I run it, telling me that I have "one too many { characters without a } to match it", but I've checked and rechecked and triple-rechecked and even had someone else check for me, to no avail. class Ball { //Global…
BenjiHare
  • 15
  • 7
0
votes
0 answers

Why does ActionScript String replace with curly brackets not work?

trace("A {0} C".replace("{0}","B")); Does not work. trace("A %0 C".replace("%0","B")); Does work. What's so special about { } curly brackets that they can not be replaced? Escaping also does not work. Anyway to get it to work?
allocater
  • 33
  • 3
0
votes
1 answer

Unreachable Code: 3 cannot be resolved to a type errors & 3 undefined for the type errors

My main issue is I'm getting an error stating: ImagePagerAdapter cannot be resolved to a type on line 80: Line 80 is ImagePagerAdapter adapter = new ImagePagerAdapter(); and I'm also getting a warning stating: The type…
0
votes
1 answer

expected ‘,’ or ‘;’ before ‘{’ token { (C++)

So I'm getting this error when i compile my code (expected ‘,’ or ‘;’ before ‘{’ token {) I know there may be many of these errors out there on stackoverflow, but can't seem to find a solution: I'm new to c++. Here is the code: I have to read…
user2836816
  • 57
  • 1
  • 2
  • 6
0
votes
4 answers

When to use "{ }" in C? [K&R Exercise 1.8]

I tried to solve this problem, which is to count the amount of lines, blank spaces, and tabs. My solution was incorrect because I don't know how to use { }. main () { int newline; int tab; int blank; int c; newline = 0; …
BBedit
  • 7,037
  • 7
  • 37
  • 50
0
votes
2 answers

return string; not working without curly brackets

This is the function I have in a .h file: static std::string ReturnString(std::string some_string) return ("\t<" + some_string + " "); The compiler (g++ -std=c++0x -pedantic -Wall -Wextra) throws these errors: error:expected identifier before…
sunam
  • 181
  • 3
  • 8
0
votes
1 answer

Extend a bracket in Adobe Illustrator without distorting middle or corners

Problem: Trying to extend a bracket without distorting the middle or the corners. Current state of bracket: If I try to extend it using the Selection Tool then the middle plus the corners will get distorted. See below: Question: How would you do…
kexxcream
  • 5,873
  • 8
  • 43
  • 62
0
votes
0 answers

Compiling inputdlg Matlab

I'm currently trying to compile a Matlab function into an exe file and I'm having trouble to get rid on the Inputdlg part. The original Matlab code is : prompt={'Charge équivalente TNT :','X foyer :','Y foyer :','Z foyer :'}; title='Données';…
0
votes
4 answers

for next loop brackets in javascript

I recently found this bit of JavaScript code (which is fine functionally) but I noticed that they're were no brackets around the for next loop. I always thought you must include them for the code to function. Under what conditions can you omit the…
Ghoul Fool
  • 6,249
  • 10
  • 67
  • 125
0
votes
3 answers

PHP include files - opening and closing brackets/braces { } for if and while loop

Sperate PHP include files - opening and closing brackets/braces { } for if's and while loop nd closing curly brackets/braces in between files Hi all , I am working with PHP includes i.e: include_once("include1.php"); And a CSS/HTML designer that is…
user1502852
0
votes
3 answers

Regex matching between curly brackets yields too many results

I have a bunch of text, for example: foofoofooabcdefhjkldh389dn{pdf}images/1.pdf,100%,500{/pdf}hfnkjt8499duidjglkj I'd like to extract the following: {pdf}images/1.pdf,100%,500{/pdf} So here's a regex I made: #{pdf}(.*?){/pdf}# When checking the…
Brian
  • 1,803
  • 1
  • 16
  • 22
0
votes
6 answers

Which is Better Performance Wise - if(condition){result} VS if(condition) result;

I know the performence difference will be very slight in both scenarios, but I was wondering which is a more practical, performance-improving version to write conditions in PHP. if(condition){ result; } VS if(condition) result;
Dzhuneyt
  • 8,437
  • 14
  • 64
  • 118