Post a reply
Username:
Note:If not registered, provide any username. For more comfort, register here.
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:
Font size:
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation of post
To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.
Confirmation code:
Enter the code exactly as it appears. All letters are case insensitive, there is no zero.
   

Topic review - redefine and kill in for loops
Author Message
  Post subject:  Re: redefine and kill in for loops  Reply with quote
If you want to assign l[pos] to s then the types must allow this.
For example, if s is of type int and l[pos] is of type string,
the assignment is not possible.
But if s will destroyed first and redefined as of type def
the assignment works and the type of s (which started as type def)
changes to string.
Post Posted: Fri Oct 11, 2013 11:38 am
  Post subject:  redefine and kill in for loops  Reply with quote
Consider a list l of rings or other objects.

Code:
...
def S;
int pos;
for (pos=1; pos<=size(l); pos++)
{
  s=l[pos];
}


Is it necessary to kill and redefine S in each loop step?
Post Posted: Thu Oct 10, 2013 12:41 pm


It is currently Fri May 13, 2022 10:58 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group