Shop OBEX P1 Docs P2 Docs Learn Events
Showing array of decimal number string — Parallax Forums

Showing array of decimal number string

ArchiverArchiver Posts: 46,084
edited 2003-06-13 19:49 in General Discussion
The following statement did not work as expected:

array VAR Byte(8)
i VAR Nib

For i = 0 TO 7
array(i) = i
NEXT
DEBUG "The array is: ", STR DEC array\8, CR

I have array of decimal numbers that I want to show.
Can I show them in a single DEBUG statement using STR and DEC
modifier somehow?

Much thanks in advance.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-06-13 19:49
    No.
    You must display them as:
    DEBUG "The array is: "
    FOR I = 0 to 7
    DEBUG DEC Array(I), 13
    NEXT I

    When you use the 'STR' modifier, it expects the
    Array to hold character code bytes. When you
    use the 'DEC' modifier, it displays the
    argument as a multi-character decimal string.

    The two aren't compatible.

    --- In basicstamps@yahoogroups.com, "basicstampede"
    <basicstampede@y...> wrote:
    > The following statement did not work as expected:
    >
    > array VAR Byte(8)
    > i VAR Nib
    >
    > For i = 0 TO 7
    > array(i) = i
    > NEXT
    > DEBUG "The array is: ", STR DEC array\8, CR
    >
    > I have array of decimal numbers that I want to show.
    > Can I show them in a single DEBUG statement using STR and DEC
    > modifier somehow?
    >
    > Much thanks in advance.
Sign In or Register to comment.