Topic: Reseting variables
Hello Dmitry and all MVD fans,
Second question of the day : I handle a lot of data from web pages. After cleaning the page source, I get a lot of data that I check against my database before saving, updating or discarding it.
In that process, after cleaning the webpage source code, I get a long StringList which is then split into an array and then, looping through the array, I send request to the database to check my data.
For each loop, the variables I use are the same (I mean same name), I would like to known what would be the correct way to reinitialize those variables at the begining of each loop.
For example :
sku_array := SplitString(cat_string,',');
for i := 0 to Length(sku_array) - 1 do
begin
known_sku := SQLExecute('SELECT COUNT(id) FROM asset WHERE asset_sku = "'+sku_array[i]+'"');
if known_sku = 0 then .....
begin
..... //some code
end
if known_sku <> 0 then
begin
..... //more awesome code
end;
known_sku := NIL; //-----> reset the variable before new loop
end;
Is it the correct way to reset a variable to make sure it is empty, or is there another / better way ?
Thanks in advance
Cheers
Mathias
Each time I get a divorce, I keep the house
Zaza Gabor