Shop OBEX P1 Docs P2 Docs Learn Events
almost done..... — Parallax Forums

almost done.....

Ben DamonBen Damon Posts: 42
edited 2005-03-02 14:22 in BASIC Stamp
Hi all, I've almost completed a simple calculator.· It's only flaw is it jumps to the beginning every time the second number is put in.· Also when the function is entered (-,+,x or /) it starts the next line with out the enter key·being pushed. thanks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ben Damon


And may God Bless America!

Comments

  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-02-28 22:24
    Ben,

    You are mixing GOTO syntax and GOSUB syntax. Change you GOTO function_name to GOSUB function_name and that will solve you're jumping to the beginning problem.

    I'd suggest, as a refreshed, to reread the help text on both the GOTO and GOSUB/RETURN command.

    Jim


    Oh yeah, the DEBUGIN, try using the 'STR' modifier for your function. Then in you IF test for '-', '+', etc. It will make the code a lot easier to read.

    You probably will want to add an additional ELSE to the IF so that an invalid function is trapped. As it stands right now, and invalid function will fall through the IF and display zero (the initialized value of the variable total) the first time through, if you add the "again" loop, an invalid function will cause the result of the previous calculation to be displayed. In any case, not what you intended.

    Post Edited (Jim McCorison) : 2/28/2005 10:32:01 PM GMT
  • Ben DamonBen Damon Posts: 42
    edited 2005-03-01 16:11
    Thank you for the quick reply.· That is the 'str' modifier?· I'm still in my first 6 months of programmingblush.gif·.· So i'm just beginning to get all the commands memorized.· Thanks to all you top dogs willing to help poeple like me.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ben Damon


    And may God Bless America!
    ·
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-03-01 18:07
    Ben said...
    So i'm just beginning to get all the commands memorized.

    Ben,

    One thing I've learned to do is to read, and reread, the manual for whatever language I'm learning. And by read, I don't mean look up the syntax of a specific command, I mean start at page 1 and work all the way through. You won't absorb all of it by any means. But you'll learn some of it, some it will stick in the back of your mind, and some will just leak out and fall on the floor.

    Then after you've been using the language for a few weeks, read through again. Guaranteed you'll be reading along and find at least one "Ah ha! So that's how you do that." By doing this you'll have at a minimum a passing acquaintance with all the commands. Then later, when you're trying to get something done, you'll remember about a command and be able to go look it up.

    Jim
  • steve_bsteve_b Posts: 1,563
    edited 2005-03-01 20:13
    Jim McCorison said...
    .... some it will stick in the back of your mind, and some will just leak out and fall on the floor.

    And here I thought I'd hit a water buffalo!
    You're right though...many of the questions asked on the forum could easily be sorted out by reading the WAM book or any of the others!!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • kb2hapkb2hap Posts: 218
    edited 2005-03-01 20:46
    Just gotto go to the parallax web site a click on downloads section

    you'll be there forever!! But you'll know a hell of a lot

    everything you need is there(at least a great start)

    http://www.parallax.com/html_pages/downloads/index.asp

    sometimes people get pissed when you tell them to go read something but your really doing them a favor.

    they asked 1 question probably had ten that could get answered by reading something.

    my 2 cents

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-03-01 21:52
    Yes, but one must give the asker of the question the benefit of the doubt. Some questions are really obvious that the first source of reference for the poster is the forum. Other questions asked are subtle in their nature. And some are of the "I'm really confused" category. Each deserves consideration. Those using the forum as a primary reference deserve a friendly pointer to the appropriate documentation the first time, a somewhat terse response the 2nd and possibly 3rd time. After that, I ignore them. Ben's question clearly falls into the "I'm confused" category. For whatever reason the GOSUB / GOTO confusion with the RETURN verb is a very common one to make. Seeing another person make it reminds me of struggling with it myself back in 19(%^$ER#$. Darn keyboard. The numbers are always messing up.

    Jim
  • kb2hapkb2hap Posts: 218
    edited 2005-03-01 23:08
    I wasn't refering to Ben D it was more a general statement.

    Bens was legit. unless you get to play and see the difference between using one over the other or mixing them the correct way that wont mess you up.

    Someone has been down that road before and can provide great insight into why certain things were happening a certain way in the code.

    Also though there is alot of great info posted in the forum that you can search for.

    I was refering more or less to some of the questions like how do I hook up a basic button or why doesnt my USB adapter work.

    I was also pushing people to take a look at all of the good resouses parallax has on there site.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-03-02 01:36
    Kb2hap,

    Guess I should have clarified. I didn't think your comments were about Ben's question. I was just afraid that Ben might have thought so as the written form of our language is so hard to communicate in. Heck, the verbal form isn't much better. smile.gif So I figured I'd say it up front.

    The posts that get me the most are the "I just bought a Widgets Electronics QX23-19. How do I connect it up to something?". Oh well.

    Jim
  • kb2hapkb2hap Posts: 218
    edited 2005-03-02 01:49
    I hear ya

    anyways back on the main note
    did ya get it working correctly yet Ben?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • Ben DamonBen Damon Posts: 42
    edited 2005-03-02 14:22
    ya it works great, for it's limmted ability. Some time latter i'll review how negetive numbers are done and add that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ben Damon


    And may God Bless America!
    ·
Sign In or Register to comment.