Shop OBEX P1 Docs P2 Docs Learn Events
Question about code (What am I doing wrong?) — Parallax Forums

Question about code (What am I doing wrong?)

JR_301JR_301 Posts: 22
edited 2009-05-07 02:26 in Learn with BlocklyProp
im on a project called Polled_RC_Timer.bs2 in the stamp homework and when I try to test my code it give me this error confused.gif

Heres the problem
messy.PNG
Heres the original code from the book

Picture.jpg

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-02 05:52
    You misspelled either "timeCounter" or "timerCounter". Take your pick! smile.gif

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 5/2/2009 7:43:05 AM GMT
  • SRLMSRLM Posts: 5,045
    edited 2009-05-02 06:33
    As a side note, if you have other problems you can just post your code, give the reference to where the source was (WAM in this case, they're all available as PDFs), and give a description of the error. No need to go to the lengths of thee photographs, though I do applaud you...
  • WhitWhit Posts: 4,191
    edited 2009-05-03 12:22
    JR_301,

    Just so you don't think you are crazy... A fresh set of eyes can usually spot a problem more easily. If you can't find someone to help you - get up and go do something else for a while and come back. Usually you can see what is wrong then!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • JR_301JR_301 Posts: 22
    edited 2009-05-04 06:10
    True Whit, im usually ready for bed and tired while doing these, so thanks for the advice, and thanks for the help everyone
  • vaclav_salvaclav_sal Posts: 451
    edited 2009-05-07 01:20
    Misspelled words are common programming errors but in this case the interpreter error code is way of·in the left field.
    It did not detect / evaluate the assumed label syntax - label ends with ":" and· the "=" should have been evalauted and appropriate·error posted.
    I think "undefined variable" would make more sense.
    It smells of "bearware". Maybe release 2.7 will correct this.



    ·
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-07 02:26
    You have to consider how a line of code gets parsed by the compiler. Chances are that it doesn't do any
    more lookahead than it has to. In this case, the compiler encounters a symbol, looks it up in the symbol
    table, and sees that it's not there. Assuming it's something legitimate (giving you, the programmer, the
    benefit of the doubt) it says, "Aha! It must be a label!", and proceeds accordingly. Imagine its
    disappointment when it sees that there's no semicolon! I guess the point I'm trying to make is that parsing
    incorrect code, being almost equivalent to mindreading, is hard. Try not to hold it against the compiler
    writers if their code can't read your mind. smile.gif

    -Phil

    Addendum: When I was in college studying computer science, the campus computer center provided
    a language called "PL/S", a student version of IBM's PL/1. Thinking they were doing the programmer a favor,
    the compiler's programmers decided to let it correct programming errors. What a disaster! It never did
    it right and ended up gobbling more precious computing seconds than if it had simply reported an error and
    aborted.

    Post Edited (Phil Pilgrim (PhiPi)) : 5/7/2009 2:35:17 AM GMT
Sign In or Register to comment.