title: How to SET a variable to the result of a rule matching multiple elements in Rebol PARSE?
body: <p>Imagine a simple example, where we want to turn the string <code>"0-5"</code> into <code>"012345"</code>.</p>
  
  <p>This works:</p>
  
  <pre><code>&gt;&gt; parse "0-5" [
      set a char!
      "-"
      set b char!
  
      (
          while [a &lt;= b] [
              prin a
              a: a + 1
          ]
      )
  ]
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>012345
  true
  </code></pre>
  
  <p>But what if I wanted something more general, that could turn <code>"10-12"</code> into <code>"101112"</code>, or beyond?  This doesn't work:</p>
  
  <pre><code>&gt;&gt; parse "0-5" [
      set a [some char!]
      "-"
      set b [some char!]
  
      (
          a-int: to integer! a
          b-int: to integer! b
          while [a-int &lt;= b-int] [
              prin to string! a-int
              a-int: a-int + 1
          ]
      )
  ]
  </code></pre>
  
  <p>The reason it doesn't work is because instead of <code>set a [some char!]</code> capturing a string of characters, it errors:</p>
  
  <pre><code>&gt;&gt; parse "10" [set a [some char!] (print a)]
  ** Script error: PARSE - invalid rule or usage of rule: char
  ** Where: parse
  ** Near: parse "10" [set a [some char] (print a)]
  </code></pre>
  
  <p>As a bonus question, why does that fail and using skip returns the first digit only?</p>
  
  <pre><code>&gt;&gt; parse "10" [set a [some skip] (print a)]
  1
  == true
  </code></pre>
  
  <p>...when <code>some skip</code> and <code>some char!</code> match equivalently on strings, since the only thing in a string to skip is a character...?</p>