Menu

operators-braces

Will Pittenger

Not really an operator but a type modifier. When this follows a Type descriptor, causes that type to become a set type. So if you have "int{}" you get a set of type int. {} can take a single parameter which, if present, must be a fixed set. (For more on fixed sets, see the {}f operator.) For more on sets, see the section [Sets].

If you use {} as part of a variable or typealias declaration, the variable or typealias is a set. If you use {} with the new keyword, you're allocating an instance of the set.

var int{} = new int{} 5, 7, 3, 9
var int{SomePreviouslyDeclaredFixedSet} = new int{SomePreviouslyDeclaredFixedSet} 5, 3

Related

Wiki: Operators
Wiki: Sets
Wiki: keywords-new
Wiki: keywords-typealias
Wiki: operators-bracesf

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.