## Re: [Clip] Simple loop question

Expand Messages
• ... Lotta gave you a perfect solution. So just in case you are interested to know what s wrong with your clip: 1. There are several tokens missing: Don t write
Message 1 of 6 , Aug 30 4:33 AM
--- In ntb-clips@yahoogroups.com, "Celtics2000" <cliffsss@...> wrote:
>
> Thank you very much!! I was definitely trying to do it the
> wrong way.
>
> ^!SetDebug On
> ^!Set %Sum%=1
> ^!Set %Sum%=(Calc(%Sum%+^?{}\$))\$
>
> :Loop
> ^!If ^%Sum% = 0 ^!Goto True
> WRITE HELLO WORLD NUMBER ^%Sum%
> ^!Set %Sum%=(Calc(%Sum%-1))\$
> ^!Goto Loop

Lotta gave you a perfect solution. So just in case you are interested to know what's wrong with your clip:

1. There are several tokens missing: Don't write '(Calc(%Sum%+etc)\$' but '^\$Calc(^%Sum%+etc)\$'.

2. In the first '^\$Calc' function, you can't use curly braces because they produce an 'error in expression' here. Use square brackets:

^!Set %Sum%=0
^!Set %Sum%=^\$Calc(^%Sum%+^?[Repeat:])\$
:Loop
WRITE HELLO WORLD NUMBER ^%Sum%^%NL%
^!Set %Sum%=^\$Calc(^%Sum%-1)\$
^!If ^%Sum% > 0 Loop

The background of this issue was described in a previous discussion in Apr 2012 -- see...

http://tech.groups.yahoo.com/group/ntb-clips/message/22573

Regards,
Flo
Your message has been successfully submitted and would be delivered to recipients shortly.