Naming rules

PHOTO EMBED

Fri Jun 14 2024 22:20:20 GMT+0000 (Coordinated Universal Time)

Saved by @pag0dy #go

/* Clean, readable code and simplicity are major goals of Go development. Therefore, the names of things in Go should be short, concise, and evocative. Long names with mixed caps and underscores which are often seen e.g., in Java or Python code, sometimes hinder readability. Names should not contain an indication of the package. A method or function which returns an object is named as a noun, no Get… is needed. To change an object, use SetName. If necessary, Go uses MixedCaps or mixedCaps rather than underscores to write multiword names. */

// Filenames are in lower case and separated by an underscore if necessary

lower_case.go

/* Go keywords: break, default, func, interface, select, case, defer, go, map, struct, chan, else, goto, package, switch, const, fallthrough, if, range, type, continue, for, import, return, var */

/* Identifuers are case-sensitive, begin with a letter or an underscore, and are followed by 0 or more letter or Unicode digits. For example: X56, group1, _x23, i, etc.

Blank identifiers (_) can be used in declarations or variable assignments, but their value is discarded, so it can't be used in the code that follows. 

Delimiters used in Go: parentheses (), Braces {} and Brackets [].

Punctuation characters in GO:
- .
- ,
- ;
- :
- ...
*/

/* Go programs consist of keywords, constants, variables, operators, types and functions. 

The code is structured in statements. Statements don't need to end with a ;. The Go compiler automatically inserts semicolons at the end of statements. 

However, if multiple statements are written on one line (not encouraged), they must be separated by a semicolon.
content_copyCOPY