Shop OBEX P1 Docs P2 Docs Learn Events
for loop with a print call that uses CRSRXY — Parallax Forums

for loop with a print call that uses CRSRXY

PhilipWongPhilipWong Posts: 8
edited 2014-03-08 02:05 in Learn with BlocklyProp
Hi guys,

I'm tryiing to do the ActivityBot tutorials, in the Test the Whiskers tutorial the last part where we do a print table. I'm not sure how or where to start.
Please help.

Phil

Comments

  • edited 2014-02-21 10:08
    Revisit this activity:

    http://learn.parallax.com/propeller-c-start-simple/counting-loops

    Consider how you can pass the value of the n variable to the print function and it displays in SimpleIDE Terminal. Couldn't you use that same variable and a for... loop to successively increase the CRSRXY positions?

    Andy
  • PhilipWongPhilipWong Posts: 8
    edited 2014-03-02 02:41
    Hi Andy,
    Alright I'm getting an idea now, the new question that I'm facing now is:
    how do I display the indentation/tab part?

    Thanks
    Phil
    Revisit this activity:

    http://learn.parallax.com/propeller-c-start-simple/counting-loops

    Consider how you can pass the value of the n variable to the print function and it displays in SimpleIDE Terminal. Couldn't you use that same variable and a for... loop to successively increase the CRSRXY positions?

    Andy
  • edited 2014-03-02 08:58
    Take a closer look at the print statement with CRSRXY in the Try This section of:

    http://learn.parallax.com/activitybot/test-whiskers

    The two numbers following CRSRXY are the the number of spaces over (X) and lines down (Y). That's what positions the cursor in the SimpleIDE Terminal. After it positions the cursor, the next print statement will start displaying characters at the new cursor position. Put that all inside a for... loop.

    NOTE: It is also possible to use print("%c message", TAB), but that is not the intent of the Your Turn. It is supposed to build off the earlier for... loop activity, and the Try This just above it.
  • edited 2014-03-02 09:05
    P.S. You can use the value of the for... loop's index variable for each value following CRSRXY to set a new cursor position each time through the loop. You can also multiply the variable that comes right after CRSRXY by 2 or 3, so that you get more spaces inward for each line down.
  • PhilipWongPhilipWong Posts: 8
    edited 2014-03-08 02:05
    Hi Andy,

    Right, I will give that a go. And if I run into more issues I'll come back and ask.

    Thanks a lot for your help!
Sign In or Register to comment.