title: How to work with char types in Dart? (Print alphabet)
body: <p>I am trying to learn the <a href="https://www.dartlang.org/docs/dart-up-and-running/contents/ch02.html" rel="noreferrer">Dart language</a>, by transposing the exercices given by my school for C programming.</p>
  
  <p>The very first exercice in our C pool is to <em>write a function <code>print_alphabet()</code> that prints the alphabet in lowercase; it is forbidden to print the alphabet directly</em>.</p>
  
  <p>In POSIX C, the straightforward solution would be:</p>
  
  <pre><code>#include &lt;unistd.h&gt;
  
  void    print_alphabet(void)
  {
      char    c;
  
      c = 'a';
      while (c &lt;= 'z')
      {
          write(STDOUT_FILENO, &amp;c, 1);
          c++;
      }
  }
  
  int     main(void)
  {
      print_alphabet();
      return (0);
  }
  </code></pre>
  
  <p>However, as far as I know, the current version of Dart (1.1.1) does not have an easy way of dealing with characters. The farthest I came up with (for my very first version) is this:</p>
  
  <pre><code>void  print_alphabet()
  {
    var c = "a".codeUnits.first;
    var i = 0;
  
    while (++i &lt;= 26)
    {
      print(c.toString());
      c++;
    }
  }
  
  void main() {
    print_alphabet();
  }
  </code></pre>
  
  <p>Which prints the ASCII value of each character, one per line, as a string ("97" ... "122"). Not really what I intended…</p>
  
  <p>I am trying to search for a proper way of doing this. But the lack of a <code>char</code> type like the one in C is giving me a bit of a hard time, as a beginner!</p>