When do we use these?Are all parenthesis or what? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

When do we use these?Are all parenthesis or what?

I wonder when this are used in code playground ( ),{ },[ ]

6th Aug 2019, 8:43 PM
Jeky Lomas
Jeky  Lomas - avatar
2 Answers
+ 3
{} often used as a body for a class or a method and can contain code. [] array stuff.. cant think of anything else 🤔 () used for precedence,arguments,parameters
6th Aug 2019, 11:48 PM
D_Stark
D_Stark - avatar
+ 2
it depends on the language ... but most often the () are used in functions/methods, assignment or in for/while/if/switch the [] are often used for Arrays like creating or accessing an array. the {} are the most variing I feel in Java they are used for seperating 'stuff' and defining arrays in python they are used for dictionaries in JavaScript they are also for sperating 'stuff' and creating Objects It really depends ... but they all have their own meaning
6th Aug 2019, 9:51 PM
Anton Böhler
Anton Böhler - avatar