Qbasicnews.com
unexpected array results - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html)
+--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html)
+--- Thread: unexpected array results (/thread-7127.html)



unexpected array results - gunder - 04-30-2005

Ok sorry, one last dumb question. I tryed playing around getting an array of single character strings. Here is my code ..

Code:
dim shared blah(0 to 2,0 to 2) as string * 1

blah(0,0) = "1"

print "[",blah(0,0),"]"

I would think the output of that would be simply "[1]", but instead I get
Code:
[              1              ]
Can anyone tell me why this is happeneing?

-gunder
p.s. Sorry, I know this is a dumb question but I've been playing with it for a couple hours and I can't figure out why it's doing it.


unexpected array results - Mitthrawnuruodo - 04-30-2005

Ok, there is nothing wrong with your array.

Its with your print statement.

Your using ',' to separate your strings, in QB or FB this makes the print statement print 15 spaces per ',' To not have all those spaces, use a ';' instead of a ',' :wink:

Here try this:

Code:
print "[";blah(0,0);"]"



unexpected array results - gunder - 05-01-2005

Hehe, I swear I'm not always this dumb. I've just been skimming over the tutorials since I know a lot of the stuff already. Guess I need to sit down and read them word for word again. Thanks for the help!

-gunder