4 ms·
Nim is not so simple language. A cheatsheet could be nice.
by captainmarble 7y ago
Nim is not so simple language. A cheatsheet could be nice.
- JNRowe 7y agohttps://learnxinyminutes.com/docs/nim/ https://learnxinyminutes.com/docs/nim/ ?
- airstrike 7y agoThanks. Some of the syntax seems rather arbitrary, but maybe just to my layman eyes... var child: tuple[name: string, age: int] but type Color = enum cRed, cBlue, cGreen why not type Color = enum[cRed, cBlue, cGreen]
- TylerE 7y agoBecause a type declaration is declaring multiple identifiers. Each of the enum variants is a legal name. The tuple declaration is declaring one identifier with multiple fields. The names of the field are only legal as, well, fields of the outer object.
- thanatropism 7y agoA tuple is a product type, an enum is a sum type.