Where is printexpressionlist defined?

Forum for discussion about the documentation project.
Post Reply
dkr
Posts: 40
Joined: Nov 20, 2015 15:17
Location: Alabama, USA

Where is printexpressionlist defined?

Post by dkr »

From the (Print/?) Using page:

Outputs formatted text to the screen or output device

Syntax

(Print | ?) [# filenum ,] [ printexpressionlist {,|;} ] Using formatstring ; [ expressionlist [ ; ] ]

Parameters
filenum
The file number of a file or device opened for Output or Append. (Alternatively LPrint may be used where appropriate, instead of Print #)
printexpressionlist
Optional preceding list of items to print, separated by commas (,) or semi-colons (;) (see Print for more details). <<-- WHERE??
formatstring
Format string to use.
expressionlist
List of items to format, separated by semi-colons (;).

Thanks,
Darren
deltarho[1859]
Posts: 4308
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: Where is printexpressionlist defined?

Post by deltarho[1859] »

(see Print for more details). <<-- WHERE??

Hover over Print, it is a link.
dkr
Posts: 40
Joined: Nov 20, 2015 15:17
Location: Alabama, USA

Re: Where is printexpressionlist defined?

Post by dkr »

My link just goes to the (Print|?) page. However, there is no documentation for a printexpressionlist

Am I looking for something that is obvious to everyone else or does this printexpressionlist exist?

Thanks,
Darren
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Where is printexpressionlist defined?

Post by fxm »

This link (KeyPgPrint) points to this information:
Consecutive values in the expression list are separated either by a comma (,) or semicolon (;). A comma indicates printing should take place at the next 14 column boundary, while a semicolon indicates values are printed with no space between them. This has a similar effect to concatenating expressions using + or &.

Print also supports the special expressions, Spc() and Tab(). These can be used to space out expressions, or to align the printing to a specific column.

A new-line character is printed after the values in the expression list unless the expression list is followed by a comma or semicolon. A Print without any expressions or separators following it will just print a new-line.
dkr
Posts: 40
Joined: Nov 20, 2015 15:17
Location: Alabama, USA

Re: Where is printexpressionlist defined?

Post by dkr »

Ok, it appears that printexpressionlist is nearly the same as the expressionlist, but has no formatting controls

The below code shows a simple example

Code: Select all

dim as integer i,j,k
dim as string a,b,c
i = 1
j = 12
k = 23
a = "1st string"
b = "2nd string"
c = "&&&&&"
print i;j;12, using c; a;b;c;a;b
sleep
I suppose that helps if you only need to format the last variable(s)

Thanks,
Darren
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Where is printexpressionlist defined?

Post by counting_pine »

Yeah, in most cases, I expect people will not want to mix formatted and unformatted output in a single Print expression, but the possibility is there if anyone wants to do that.
In practice, maybe it's not a feature worth having, since makes the documentation a little more complex, and possibly means more complexity for the compiler. But I guess the main reason it's there is probably because QBASIC supported it.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Where is printexpressionlist defined?

Post by fxm »

In some cases, this can make it possible to compact two obligatorily separated instructions (because of the "comma" in the very simple example which follows) in only one:

Code: Select all

Dim As Double a = 31.7, b = -2.5

'Print Using "The different return values are:", & "a=###.##   b=##.#"; a; b   '' does not work

Print "The different return values are:",
Print Using "a=###.##   b=##.#"; a; b

Print "The different return values are:", Using "a=###.##   b=##.#"; a; b

Sleep
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Where is printexpressionlist defined?

Post by speedfixer »

Perhaps a very **simple** extra example could be added to the docs to display this 'feature' of embedding using in the expressionlist.

Quick, easy, done.
Post Reply