BBC BASIC for Windows
Programming >> BBC BASIC language >> using " DIM"
http://bb4w.conforums.com/index.cgi?board=language&action=display&num=1394016287

using " DIM"
Post by Wendell on Feb 27th, 2014, 05:36am

pr$="PROBLEM"
DIM pr$(10)
FOR K= 1 TO 10
*FONT TERMINAL,10
PRINT TAB(39,25)laughr$(K)

NEXT K



I am trying to print "problem"out exp. PROBLEM (!) etc
can't get it to work
Re: using " DIM"
Post by admin on Feb 27th, 2014, 07:55am

on Feb 27th, 2014, 05:36am, Wendell wrote:
I am trying to print "problem"out exp. PROBLEM (!) etc

I'm very sorry, but I can't figure out what it is you are trying to do, and your code doesn't make a lot of sense. You subject line is "using DIM" but you don't seem to need an array at all!

Can you attempt another explanation please, perhaps with an example of what you want the output to look like?

Please try to choose a more appropriate section to post in than 'General'.

Richard.
Re: using " DIM"
Post by Wendell on Feb 27th, 2014, 10:25am

thank you will wait until i get more familiar with programing before i ask questions.


PROBLEM (1)
PROBLEM (2)
PROBLEM (3)


I WA TRYING TO PUT PR$ IN A ARRAY TO PRINT 10 TIME IN A LOOP
Re: using " DIM"
Post by Edja on Feb 27th, 2014, 12:20pm

I suppose the following is already closer to what you are trying to do. At least it corrects a few mistakes and should help you further on the way.

*FONT TERMINAL,10
DIM pr$(10)
pr$()="PROBLEM"
FOR K= 1 TO 10
PRINT TAB(15,K) K pr$(K)
NEXT K

But it's not very clear what you are trying to do.

Re: using " DIM"
Post by admin on Feb 27th, 2014, 3:28pm

on Feb 27th, 2014, 12:20pm, Edja wrote:
*FONT TERMINAL,10
DIM pr$(10)
pr$()="PROBLEM"
FOR K= 1 TO 10
PRINT TAB(15,K) K pr$(K)
NEXT K

But it's not very clear what you are trying to do.

Although that code works fine, it works equally well without using an array at all:

Code:
pr$="PROBLEM"
FOR K= 1 TO 10
    PRINT TAB(15,K) K pr$
NEXT K 

Richard.

Re: using " DIM"
Post by Edja on Feb 27th, 2014, 9:39pm

Based on the subject line "Using DIM" I assumed Wendell was trying to figure out how to work with the DIM statement and how to initialize arrays. So I've stayed close to the original code and only corrected a few mistakes.

But indeed there is no need for an array at all.

Eddy
Re: using " DIM"
Post by Wendell on Feb 28th, 2014, 6:17pm

yes thank you ,,experimenting with the DIM statement can be mind bogging . thanks again
Re: using " DIM"
Post by admin on Feb 28th, 2014, 10:38pm

on Feb 28th, 2014, 6:17pm, Wendell wrote:
experimenting with the DIM statement can be mind bogging

Have you worked through the relevant chapter of the Beginners' Tutorial?

http://www.bbcbasic.co.uk/bbcwin/tutorial/chapter14.html

Richard.
Re: using " DIM"
Post by Wendell on Mar 1st, 2014, 01:41am

I have browse that area. sometime a little confusing. i have some knowledge of liberty basic. I get them confuse sometimes. But i love BBC basic . especially Graphics or printing in FONTS AND COLORS.MUCH easier that liberty basic