+ 4
When do we use these?Are all parenthesis or what?
I wonder when this are used in code playground ( ),{ },[ ]
2 Antworten
+ 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
+ 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