Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

71%
+3 −0
Q&A Syntax summaries use brackets for optional elements; how do I represent literal brackets in a way readers will understand?

Official ISO programming standards that describe programming language syntax etc often use opt to mark an argument as optional (with "OPT" in italics). So I would propose to write ARRAY[data-typ...

posted 4y ago by Lundin‭

Answer
#1: Initial revision by user avatar Lundin‭ · 2020-11-05T14:17:05Z (about 4 years ago)
Official ISO programming standards that describe programming language syntax etc often use <sub>_opt_</sub> to mark an argument as optional (with "OPT" in italics). So I would propose to write

> ARRAY[data-type, count<sub>_opt_</sub>]

This has the advantage that the abbreviation "OPT" is kind of self-explanatory and you don't have to write an explicit note about count being optional.

The disadvantage is that you need some manner of formatted text or HTML (`<sub>`) to support this, so it won't work in raw source code comments/raw Doxygen etc.

I wouldn't use italics for the optional parameter itself (_count_), because that's very ambiguous. Italics can be used for a lot of diverse things: emphasis, place-holders, formal definition of technical terms, source code identifiers and so on.