( ) vs [] Any hints about the logic behind using one or the other

It becomes confusing to me when to use parentheses() or brackets , or curly braces {}. Are there any general guidelines in programming as to when each one should be used. Or, does one just need to memorize use in each programming language.

Probably closer to that, though I’m not sure memorize is the best word. It’s important to note that they are not interchangeable. Their use is definitely language specific. There would be few if any universal rules. There are typical uses that span many languages, but learning the use of (), [], {} will come with learning the language. I wouldn’t concentrate on memorizing when to use each.

1 Like

Thanks so much. Just need to use as few languages as possible, I guess.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.