Repeat

Discussion in 'AutoCAD' started by Adesu, Apr 23, 2004.

  1. Adesu

    Adesu Guest

    Dear Alls,
    (setq a 10 b 100)
    (repeat 4 (setq a (+ a 10)) (setq b (+ b 100))) return 500
    Can you give me how to elaborate this function to got 500
    Thanks for your reply
    Best regards
    Ade Suharna
     
    Adesu, Apr 23, 2004
    #1
  2. Adesu

    bob.at Guest

    Ade,

    this function does the following: add 10 to var a 4 times, that gives 50. Add 100 to variable b 4 times, gives 500. So aou have after the repeat command: a=50, b=500.
    And in addition repeat returns the result of the last calculation within the repeat function, that is the last (+ b 100) and that is 500.

    bob.at
     
    bob.at, Apr 23, 2004
    #2
  3. Adesu

    Adesu Guest

    Hi bob,
    You mean "add 100 to variable b 4 times ,gives 500" is
    100 ( 100 + 100 + 100 +100) = 500 =====> this you mean !

    Add 100 to variable b 4 times, gives 500. So aou have after the repeat
    command: a=50, b=500.
    the repeat function, that is the last (+ b 100) and that is 500.
     
    Adesu, Apr 23, 2004
    #3
  4. Adesu

    bob.at Guest

    you 've got it :)

    bob.at
     
    bob.at, Apr 23, 2004
    #4
  5. Adesu

    Adesu Guest

    Hi bob,thanks a lot for comment,now I understand it
     
    Adesu, Apr 26, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.