SAIL - Reverse

Modding, patches, etc., for anyone who speaks neither Polish nor Czech.
Post Reply
User avatar
Morphid
Site Administrator
Site Administrator
Czech Republic
Posts: 86
Joined: Sat Dec 25, 2010 12:48 am
Location: Czech Republic
Contact:

SAIL - Reverse

Post by Morphid »

This function reverses all values in the list that the first one will be last etc.

Code: Select all

list:=[1,2,3,4,5,6];
list:=Reverse(list);
// list = [6,5,4,3,2,1];

Code: Select all

export function Reverse(list);
var i;
begin
     result:=list;
     for i:=1 to list do
       result:=Replace(result, i, list[(list+1)-i]);
end;
User avatar
YuriStriatov
Site Administrator
Site Administrator
Cuba
Posts: 1395
Joined: Fri Feb 17, 2006 3:02 am
Contact:

Re: SAIL - TurnValuesInList

Post by YuriStriatov »

Something like http://www.php.net/manual/en/function.array-reverse.php ?

Nice, but maybe better naming convention for function :P
Image
User avatar
Morphid
Site Administrator
Site Administrator
Czech Republic
Posts: 86
Joined: Sat Dec 25, 2010 12:48 am
Location: Czech Republic
Contact:

Re: SAIL - Reverse

Post by Morphid »

thanks for your idea ;).. I corrected the name of this function
Post Reply