title: How to define a single byte variable in go lang
body: <p>I am a newbie to golang and want to find a way to define a <strong>single</strong> <code>byte</code> variable.</p>
  
  <p>It's a demo program in <em>Effective Go</em> reference.</p>
  
  <pre><code>package main
  
  import (
     "fmt"
  )
  
  func unhex(c byte) byte{
      switch {
      case '0' &lt;= c &amp;&amp; c &lt;= '9':
          return c - '0'
      case 'a' &lt;= c &amp;&amp; c &lt;= 'f':
          return c - 'a' + 10
      case 'A' &lt;= c &amp;&amp; c &lt;= 'F':
          return c - 'A' + 10
      }
      return 0
  }
  
  func main(){
      // It works fine here, as I wrap things with array.
      c := []byte{'A'}
      fmt.Println(unhex(c[0]))
  
      //c := byte{'A'}    **Error** invalid type for composite literal: byte
      //fmt.Println(unhex(c))
  }
  </code></pre>
  
  <p>As you see I can wrap a byte with array, things goes fine, but How can I define a single byte without using array? thanks.</p>