mirror of
https://github.com/golang/go
synced 2024-11-22 05:44:41 -07:00
spec: remove redundant, outdated definition of default literal types
R=golang-dev, r CC=golang-dev https://golang.org/cl/5480047
This commit is contained in:
parent
012798a325
commit
6a47bb4974
@ -1778,23 +1778,7 @@ of the expression list.
|
|||||||
<p>
|
<p>
|
||||||
If the type is absent and the corresponding expression evaluates to an
|
If the type is absent and the corresponding expression evaluates to an
|
||||||
untyped <a href="#Constants">constant</a>, the type of the declared variable
|
untyped <a href="#Constants">constant</a>, the type of the declared variable
|
||||||
is <code>bool</code>, <code>int</code>, <code>float64</code>,
|
is as described in §<a href="#Assignments">Assignments</a>.
|
||||||
<code>complex128</code>, or <code>string</code> respectively, depending on
|
|
||||||
whether the value is a boolean, integer, floating-point, complex, or string
|
|
||||||
constant:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
var b = true // t has type bool
|
|
||||||
var r = 'a' // r has type int
|
|
||||||
var i = 0 // i has type int
|
|
||||||
var f = 3.0 // f has type float64
|
|
||||||
var c0 = 0i // c0 has type complex128
|
|
||||||
var c1 = 1 + 0i // c1 has type complex128
|
|
||||||
var c2 = 1 + 1i // c2 has type complex128
|
|
||||||
var s1 = "OMDB" // s1 has type string
|
|
||||||
var s2 = `foo` // s2 has type string
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h3 id="Short_variable_declarations">Short variable declarations</h3>
|
<h3 id="Short_variable_declarations">Short variable declarations</h3>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user