Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use the MinWidth specifier for your integer values.</p> <pre><code>WriteLn(intValue:2); // displays the number with a width of 2 </code></pre> <p>For floating point values, you can also add a value for the number of decimals:</p> <pre><code>WriteLn(floatVal:5:2); </code></pre> <p>You can find documentation for the specifier in <a href="http://docwiki.embarcadero.com/Libraries/XE5/en/System.Write" rel="nofollow"><code>System.Write</code></a> - it's Delphi documentation, but Delphi had its roots long ago in Turbo Pascal, and <code>Write/WriteLn</code> are legacy Pascal functions and haven't changed.</p> <blockquote> <p>A write parameter has the form: </p> <p>OutExpr [: MinWidth [: DecPlaces ] ]</p> <p>where OutExpr is an output expression. </p> <p>MinWidth and DecPlaces are type integer expressions: </p> <p>MinWidth specifies the minimum field width, which must be greater than 0. Exactly MinWidth characters are written (using leading blanks if necessary) except when OutExpr has a value that must be represented in more than MinWidth characters. In that case, enough characters are written to represent the value of OutExpr. Likewise, if MinWidth is omitted, then the necessary number of characters is written to represent the value of OutExpr. </p> <p>DecPlaces specifies the number of decimal places in a fixed-point representation of one of the Real types. It can be specified only if OutExpr is one of the Real types, and if MinWidth is also specified. When MinWidth is specified, it must be greater than or equal to 0.</p> </blockquote> <p>Here's a quick sample:</p> <pre><code>NT = 12; NB = -1; WriteLn('+---+'); WriteLn('|\', NT:2, '|'); WriteLn('| \ |'); WriteLn('|', NB:2, '\|'); WriteLn('+---+'); ReadLn; </code></pre> <p>This produces</p> <pre><code>+---+ |\12| | \ | |-1\| +---+ </code></pre> <p>If you need more output than two wide, you'll need to enlarge your box:</p> <pre><code>+-----+ |\ 120| | \ | | \ | | \ | |123 \| +-----+ </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload