[futurebasic] Re: [FB] Editor Question (Printing Array Elements)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 2010 : Group Archive : Group : All Groups

From: Tom Russell <tom@...>
Date: Wed, 4 Aug 2010 23:07:51 -0400
I tried your code stu and the file is empty? Not sure what i am doing wrong with your code.

Tom

On Aug 4, 2010, at 10:15 PM, Stu Cram wrote:

> 
> On 4-Aug-10, at 7:48 PM, Tom Russell wrote:
> 
>> It looks like this:
>> 
>> PRINT #1, M(0,i) chr$( 9 ) M(1,i) chr$( 9 ) M(2,i) chr$( 9 ) M(3,i) chr$( 9 ) M(4,i) chr$( 9 ) M(5,i) chr$( 9 ) M(6,i) chr$(9) M(7,i) chr$( 9 ) M(8,i) chr$( 9 ) M(9,i) chr$( 9 ) M(10,i) chr$( 9 ) M(11,i) chr$( 9 ) M(12,i) chr$( 9 ) M(13,i) chr$( 9 )
>> M(14,i) chr$( 9 ) M(15,i) chr$( 9 ) M(16,i) chr$( 9 ) M(17,i) chr$( 9 ) M(18,i) chr$( 9 ) M(19,i)
> ___________________________________
> 
> Hi Tom,
> As Brian S mentioned, you can break the PRINT command into several PRINTs.
> In you particular example, you could also use a FOR loop to print each item of the array followed by the tab character, something like this (assuming subscript range goes from 0-19).
> 
> '=====================================================================
> 
> DIM AS INTEGER x
> DIM AS INTEGER itemLimit
> DIM as STRING  tabChar
> 
> tabChar   = char(9)
> itemLimit = 19
> 
> ' print all items with second subscript i on the same row.
> FOR x = 0 TO itemLimit
>  ' print an element
>  PRINT M(x,i);
>  ' followed by a tab except for the last one at the end of the line
>  IF x <= itemLimit THEN PRINT tabChar; ELSE PRINT
> NEXT x
> 
> '===================================================================
> 
> Note extensive use of comments and descriptive variables;
> these habits can save you time in the long run.
> 
> Hope this helps.
> - Stu
> 
> --
> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>