print bar

Prev Next

Function Names

print bar

Library

Console Library

Description

This function prints a sequence of characters, for example a horizontal line, across the full width of the screen.

Call as: procedure

Restrictions

Under normal conditions, the 'Console Library' is loaded automatically, so no 'include(...)' call is needed.

Parameter count

0 - 3

Parameters

No.TypeDescription
Opt. 1
input
string Pattern

The supplied pattern will be applied repeatedly until the screen or specified boundaries have been reached. If a blank string is provided, then it will be replaced by the default pattern, namely the underscore character '_'. The patterns will be stopped when the final position has been reached, even if the last used pattern as supplied is incomplete.

Default value: '_' (underscore character)
Opt. 2.
input
numeral Count

The count can be specified with following three approaches

1 or bigger Specifies a fixed pattern width in number of single characters.
0 Nothing
negative Specifies current screen width minus the number of single characters. A -10 leaves 10 columns blank on the right hand side.
>0...<1 (fractional) The number of single characters is specified by multiplying the fractional value with the screen width

Default value: -1 (full screen width)
Opt. 3.
input
numeral Offset

The offset provides a specified number of spaces and will then reduce the number of characters as specified in the 2nd function parameter.

1 or bigger Specifies a fixed number of characters. If the 2nd function parameter specifies a negative or fractional value, then the count will be reduced by the offset.
0 Offset is 0.
negative Specifies current screen width minus the number of single characters. A -30 provides an offset of 50 characters for a console with width of 80 characters.
>0 .. <1 (fractional) The number of single characters is specified by multiplying the fractional value with the screen width

Default value: 0

Examples

       echo( "Width of console is: ", console(width) );
       print bar( '.*.' );
       print bar( '+',   0.5, 10);
       print bar( '_', -60 );

Output

Width of console is: 80
.*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..*..
          ++++++++++++++++++++++++++++++
____________________
Try it yourself: Open LIB_Function_print_bar.b4p in B4P_Examples.zip. Decompress before use.

See also

format print
print
echo