Go Concepts - Lexical Structure: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
Line 18: Line 18:


Upper-case letter identifiers
Upper-case letter identifiers
=Whitespace=
Newlines, spaces and tabs.
=Expression=
[[Go Concepts - Operators|Operators]] combine operands into [[#Expression|expressions]].
==Literal==
===String Literal===
===Numeric Literal===
===Array Literal===
===Slice Literal===
===Map Literal===
===Struct Literal===
=Comment=
<pre>
// to the end of the line
</pre>
<pre>
/*
  Multiline
  line 1
  ...
  line n
*/
</pre>
=Statements=
==for==
==if==
=Keywords=
* Go Specification - Keywords: https://golang.org/ref/spec#Keywords
{|
| <tt>[[go Keyword range|range]]</tt> || <tt>[[go Keyword type|type]]</tt> || <tt>[[go Keyword func|func]]</tt> || . || .
|-
|  <tt>[[go Keyword package|package]]</tt> || <tt>[[go Keyword go|go]]</tt> || . || . || .
|-
| <tt>[[go Keyword defer|defer]]</tt> || <tt>[[go Keyword chan|chan]]</tt> || . || . || .
|}
=Constants=

Revision as of 23:52, 21 March 2016

Internal



Identifiers

Types, functions, constants, variables, interfaces.

The blank identifier "_".

Identifiers (not values) can be exported or unexported.

Lower-case letter identifiers

Upper-case letter identifiers


Whitespace

Newlines, spaces and tabs.

Expression

Operators combine operands into expressions.

Literal

String Literal

Numeric Literal

Array Literal

Slice Literal

Map Literal

Struct Literal

Comment

// to the end of the line
/*
  Multiline
  line 1
  ...
  line n
*/

Statements

for

if

Keywords

range type func . .
package go . . .
defer chan . . .

Constants