|
Boost : |
From: James Curran (JamesCurran_at_[hidden])
Date: 2002-04-15 12:53:54
The fact that the format string was up front was way done on the list of
advantages of PRINT USING (so far that many would consider it a
disadvantage, or at least were neutral about it).
The primary advantage of the Basic PRINT USING was that it offered
formatting options that were difficult any other way. For example:
f = 1.0
print using "###.##"; f ' prints " 1.00" (exactly six
characters)
otherwise you'd have to write:
f = 1.0
S$ = str(f)
i = instr(S$, ".")
if i = 0 then S$ = S$ + ".00"
else S$ = Left$(S$+"00", i + 2)
S$ = right$(" " + S$, 6)
print S$
-- Truth, James Curran www.NJTheater.com (Professional) www.NovelTheory.com (Personal) "Mattias Flodin" <flodin_at_[hidden]> wrote in message news:20020409095833.A16488_at_ronja.cs.umu.se... Personally, I think the latter. It is interesting to note that the PRINT statement in BASIC had cout-style printing from the start; the printouts were concatenated using ";" or "," operators, if one can call them operators. However, for the sake of readability and ease-of-use, many dialects later added the PRINT USING statement that allowed to you to provide a (type independent, i.e. no loss of type safety) format string first, and then let the arguments to the string follow.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk