title: Should I use $(( )) to evaluate arithmetic expressions in ksh?
body: <p>1) Should I use $(( )) if I operate on integers? </p>
  
  <pre><code>&gt;typeset -i x=0
  &gt;typeset -i y=0
  &gt;typeset -i z=0
  &gt;y=$(($x+1))
  &gt;print $y
  1
  &gt;z=$x+1
  &gt;print $z
  1
  </code></pre>
  
  <p>As you can see there are correct results both in z and y.<br>
  Only in case if variable was not declared as integer there is difference:  </p>
  
  <pre><code>&gt;typeset j
  &gt;typeset k
  &gt;j=$(($x+1))
  &gt;print $j
  1
  &gt;k=$x+1
  &gt;print $k
  0+1
  </code></pre>
  
  <p>2) What is the difference between $(($x+1)) and $((x+1))?  </p>
  
  <blockquote>
    <p>print $(($x+1))<br>
    1<br>
    print $((x+1))<br>
    1</p>
  </blockquote>
  
  <p>There is the same situation with let:  </p>
  
  <blockquote>
    <p>x=1<br>
    let x=$x+1<br>
    print $x<br>
    2<br>
    let x=x+1<br>
    print $x<br>
    3</p>
  </blockquote>