The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Visibility of a var outside a cycle
03-09-2015, 11:59 AM
Post: #1
Visibility of a var outside a cycle
hi,
I've a code like this one:
Code:

local j, m, tn;
...
FOR j FROM 1 TO m DO
...
tn:= tn + ∑LIST(DL(j));
END;
return tn^2;
...

now, tn is actually 1024 (i.e.), outside the FOR cycle "Return tn" give 1024, but "return tn^2) give 1449616 and not the right value (1048576); "return tn*2" give correctly 2048, "return tn*tn" give also 1449616...

How must I set the variable to give the correct value, also with tn^2 and so on, outside the cycle?

Thanks!

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Visibility of a var outside a cycle - salvomic - 03-09-2015 11:59 AM



User(s) browsing this thread: 1 Guest(s)