small bug with continue

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
Placemate
GamingTools Subscriber
Posts: 16
Joined: Wed Oct 13, 2004 12:54 pm

small bug with continue

Post by Placemate » Thu Jun 30, 2005 3:36 am

Code: Select all

function main()
{
	declare i int local 1
	do
	{
		echo ${i}
		if "1"
			continue
	}
	while "$&#123;i&#58;inc&#125;<10"
&#125;
This loop will never exit, i isn't being incremented for some reason.

Darkgecko
Non-Subscriber
Posts: 23
Joined: Sun Sep 26, 2004 5:04 am

Post by Darkgecko » Thu Jun 30, 2005 4:36 am

Code: Select all

function main&#40;&#41; 
&#123; 
declare i int local 1 
do 
	&#123; 
	echo $&#123;i&#125; 
	&#125; 
	while "$&#123;i&#58;Inc&#125;<10" 
&#125;
Is going to count to 10 and then stop.

Code: Select all

function main&#40;&#41; 
&#123; 
declare i int local 1 
do 
	&#123; 
	echo $&#123;i&#125; 
	  if "1"
    	    continue
	&#125; 
	while "$&#123;i&#58;Inc&#125;<10" 
&#125;
Is going to count to "1" and then because you said if "1" continue, it's going to leave the "do" command and ignore the while, and start all over, hence echoing 1 forever. Which is what you are telling it to do there.

If I am wrong someone correct me please :)

Darkgecko
Non-Subscriber
Posts: 23
Joined: Sun Sep 26, 2004 5:04 am

Post by Darkgecko » Thu Jun 30, 2005 5:08 am

Well after reading the wiki again, I guess it should do the :Inc afer all :)

Ignore previous post which I cant edit!

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Thu Jun 30, 2005 7:52 am

indeed, it should do the :Inc. However, it's not capitalized and it wouldn't work like that even if there wasnt the continue bug :) Which is now fixed in LavishScript 1.30 and will be included in the next IS build. Thanks for the report

Post Reply