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
Where is printexpressionlist defined?
-
- Posts: 4308
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: Where is printexpressionlist defined?
(see Print for more details). <<-- WHERE??
Hover over Print, it is a link.
Hover over Print, it is a link.
Re: Where is printexpressionlist defined?
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
Am I looking for something that is obvious to everyone else or does this printexpressionlist exist?
Thanks,
Darren
Re: Where is printexpressionlist defined?
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.
Re: Where is printexpressionlist defined?
Ok, it appears that printexpressionlist is nearly the same as the expressionlist, but has no formatting controls
The below code shows a simple example
I suppose that helps if you only need to format the last variable(s)
Thanks,
Darren
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
Thanks,
Darren
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
Re: Where is printexpressionlist defined?
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.
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.
Re: Where is printexpressionlist defined?
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
-
- Posts: 606
- Joined: Nov 28, 2012 1:27
- Location: CA, USA moving to WA, USA
- Contact:
Re: Where is printexpressionlist defined?
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.
Quick, easy, done.