14.5 years later, I should have just RTFM. :) --SOLVED--
Wed Sep 01, 2021 4:45pm
Puckdropper was on the right track with the white spaces.
I stumbled back on this topic because I was checking the old news entries and this was linked. Because it was never solved, I tried to recreate it.
Sure enough, it did just as it did back then (why wouldn't it?)
Doing the following:
Prints the output as expected, but only because it's being converted to a string and then the spaces are being trimmed.
Turns out when printing integer values, QB automatically appends the number with a space and prefixes it with one as well if the number is positive when used in a print command raw. The prefix space is used to print the minus sign if needed.
So, it's a stupid "helper" oddity built right into the print command that was causing the code to act weird.
Literally all I had to do was press F1 on print and go to the Details tab. It's right there. (There's also some mangling going on with doubles)
PRINT Statement Details
If expressionlist is omitted, a blank line is printed. If
expressionlist is included, the values of the expressions are printed
on the screen. The expressions in the list may be numeric or string
expressions. (String literals must be enclosed in quotation marks.)
A printed number is always followed by a space. If the number is
positive, it is also preceded by a space; if the number is negative,
it is preceded by a minus sign (-).
There are two formats that PRINT uses to display single- and
double-precision numbers: fixed point and floating point. If PRINT
can represent a single-precision number in the fixed-point format
with seven or fewer digits and no loss of accuracy, then it uses the
fixed-point format; otherwise, it uses the floating-point format.
For example, the number 1.1E-6 is output displayed as .0000011, but
the number 1.1E-7 is output as 1.1E-7.
Similarly, if PRINT can represent a double-precision number in the
fixed-point format with 16 or fewer digits and no loss of accuracy,
then it uses the fixed-point format; otherwise, it uses the floating
point format. For example, the number 1.1D-15 is output as
.0000000000000011, but the number 1.1D-16 is output as 1.1D-16.
It's only displaying the last line when using the locate command, but without it spits it all out. The locate command works when I use a static character though. (Which is why I have no idea what's wrong...) Here's what I have: CLS DIM matrix(1 TO 5, 1 TO 5) AS INTEGER PRINT "Opening MATRIX.D... more
14.5 years later, I should have just RTFM. :) --SOLVED--- Erik_,Wed Sep 01 2021 4:45pm
Who does that?
Seriously, WHO DOES THAT?
I get why they did that, it's kinda annoying to do a
cout when you want to make a simple table.
print "My Values", value, value2, value3 is much cleaner.
(I think I read the manual for print back in like 1999. Oh those wild "end of the mil... more
jumping to documentation when I have a question about how/why something is working not like I expect it to.
COBOL is full of weirdnesses and multiple ways to do things.
Example, here's one of the DISPLAY statement's possible syntaxes:
Source: https://www.microfocus.com/docum... more
at least in the beginning. That said, I feel like I rarely got into more than a small set of the commands available and just found ways to hack together the same few commands to make things "work". Grimace, Wry, and the Dragon Slayer Demo are great examples of this. It's a ton of spaghetti code do... more
until I was introduced to them in college... I may not be super familiar with Perl, but Larry Wall's philosophies changed the way I view certain things. One is if an operation is really common, maybe someone's already got a command for it. So there's RTRIM$, LTRIM$, etc because people needed to r... more
32 million downloads: https://www.npmjs.com/package/is-even
But in a rational sense, that's a good philosophy. These days, I find myself looking to see if someone already created a package or library online before attempting to reinvent the wheel myself.
I think my first real experience wit... more
d tells you if the result has a remainder? (Or shoot, you can just look at the last bit. If 1, not even.) It would kinda make sense in C, where the package could handle different numbers and number types, but isn't a number in JS just a number? (Been a while since I've looked at JS.)
One area... more
It relies on another package called "is-odd".
This is the entire code for "is-even"
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
I guess that could be a good programming language feature. After all, you're better off with well used libraries than you are writing your own in most cases. (The number of "Apps" on Android that are rewritten versions of other apps--with no more features or even a different design is staggering. ... more
I can use the data loaded into the matrix to define the color of the block that I'm outputing. I just can't output it exactly. Ex: FOR x% = 1 TO 5 FOR y% = 1 TO 5 COLOR matrix(x%, y%) PRINT "#" NEXT y% NEXT x% I'm thinking if I store the data in double quotes ("") in the file, it'l... more
You can rewrite QB and add a CHAR datatype, or just live with the space penalty. Oooh! Oooh! I know! You can create defined strings of every string that you can have, and then use those throughout your program. Think of the number of times you'll save four bytes!