Shop OBEX P1 Docs P2 Docs Learn Events
multi-line code ? — Parallax Forums

multi-line code ?

Areal PersonAreal Person Posts: 197
edited 2007-11-14 01:05 in Propeller 1
How do I do multiline code statments ?

I got this DAT block, I'm making a array

COL···· byte··· %1000000000000000, %0100000000000000, %0010000000000000, %0001000000000000,
··············· %0000100000000000, %0000010000000000, %0000001000000000, %0000000100000000,
··············· %0000000010000000, %0000000001000000, %0000000000100000, %0000000000010000,
··············· %0000000000001000, %0000000000000100, %0000000000000010, %0000000000000001,··

But this does not work ?

How do I do it as a multi-line, because 16 across is to much for one line of code.

Thanks,
-Areal

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I have a tree growing out of my head, but

what do you expect ? I'm a programmer.

Comments

  • CardboardGuruCardboardGuru Posts: 443
    edited 2007-11-13 22:39
    Hi Areal,

    The binary values you have there are words(16 bit) not bytes. So you'd do this:

    COL word %1000000000000000, %0100000000000000, %0010000000000000, %0001000000000000
    word %0000100000000000, %0000010000000000, %0000001000000000, %0000000100000000
    word %0000000010000000, %0000000001000000, %0000000000100000, %0000000000010000
    word %0000000000001000, %0000000000000100, %0000000000000010, %0000000000000001

    Or if you really do want bytes, split up the values into 8 bits at a time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Help to build the Propeller wiki - propeller.wikispaces.com
    Prop Room Robotics - my web store for Roomba spare parts in the UK
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-11-13 22:43
    Areal, For your example, you should follow CardboardGuru's advice. For other examples where this isn't feasible (say a really long string) you can end the line with { then start the next line with }. What this does is place the carriage return within a comment so the compiler sees the second line as a continuation of the first.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-11-13 22:50
    They would take up a lot less space if you write them in hex.

    Of course, if you did that it may become more apparent that this series is hardly memorable enough to park in an array.

    Or more politely, why bother putting these datum into an array when you can calculate it as (or more?)·quickly as you can look it up?

    Post Edited (Fred Hawkins) : 11/13/2007 11:00:05 PM GMT
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-13 23:56
    Paul Baker (Parallax) said...
    .... you can end the line with { then start the next line with }
    Ingenious!
  • Areal PersonAreal Person Posts: 197
    edited 2007-11-14 01:05
    Thanks everyone for helping me [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I have a tree growing out of my head, but

    what do you expect ? I'm a programmer.
Sign In or Register to comment.