loop index I

nnCron and nnCron LITE discussion

loop index I

Postby alexanjo » Sat, 31 Dec 2005, 22:24

How to output the loop index I using MSG?

When the following code snippet runs:

10 0 DO

MSG: "%I @%"

LOOP

it produces the following error in the Console window:

Error macro variable substitution:I @

Jordan
alexanjo
 
Posts: 19
Joined: Tue, 22 Nov 2005, 01:57

Postby Valery_Kondakoff » Sun, 01 Jan 2006, 03:59

Please, read carefully the answer on a 'What means does Forth provide for creating a simple loop?' question ( http://www.nncron.ru/help/EN/add_info/f ... q.htm#loop ). Especially all the info about 'I' word. There is an example of outputting the 'I' in a message box.

Hint: 'I' is _not_ a variable. This is a word, which puts the loop index on the stack. So - you can use this value as an ordinary numeric value.

Do you still have additional questions?
CU
VK
User avatar
Valery_Kondakoff
Site Admin
 
Posts: 769
Joined: Thu, 01 Jul 2004, 20:49
Location: Moscow, Russia

Thank you, Valery -- no additional questions!

Postby alexanjo » Sun, 01 Jan 2006, 06:28

I read that section too quickly and missed the key example!

Jordan
alexanjo
 
Posts: 19
Joined: Tue, 22 Nov 2005, 01:57


Return to nnCron forum (English)

Who is online

Users browsing this forum: No registered users and 2 guests

cron