Difference between revisions of "TIAAddEx"

From SCAR Divi Manual
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Definition==
 
==Definition==
 
<source lang="scar" lines="false">
 
<source lang="scar" lines="false">
procedure TIAAddEx(var TIA: TIntArray; const Additions: TIntArray);
+
procedure TIAAddEx(var TIA: TIntArray; const Values: TIntArray);
 
</source>
 
</source>
  
Line 8: Line 8:
  
 
==Description==
 
==Description==
Adds the values from the [[TIntArray]] '''Additions''' to the values in '''TIA'''. The items in '''Additions''' are added in the order they are given. When the end of '''Additions''' is reached, it will start again from the first item. When '''Additions''' is empty, '''TIA''' remains unchanged.
+
Adds the values from the [[TIntArray]] '''Values''' to the values in '''TIA'''. The functions alternates between the values in '''Values'''. When '''Values''' is empty, '''TIA''' remains unchanged.
  
==Example==
+
==Examples==
 +
===Example 1===
 
<source lang="scar">
 
<source lang="scar">
 
var
 
var
   TIA: TIntArray;
+
   TIA: TIntArray;
+
 
 
begin
 
begin
   TIA := [5, -7, 1, 6, 88];
+
   TIA := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
   TIAAdd(TIA, 5);
+
   TIAAddEx(TIA, [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]);
 
   WriteLn(TIAToStr(TIA));
 
   WriteLn(TIAToStr(TIA));
 
end.
 
end.
Line 23: Line 24:
  
 
Output:
 
Output:
  10,-2,6,11,93
+
  9,9,9,9,9,9,9,9,9,9
 +
 
 +
===Example 2===
 +
<source lang="scar">
 +
var
 +
  TIA: TIntArray;
 +
 
 +
begin
 +
  TIA := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
 +
  TIAAddEx(TIA, [2, 1]);
 +
  WriteLn(TIAToStr(TIA));
 +
end.
 +
</source>
 +
 
 +
Output:
 +
2,2,4,4,6,6,8,8,10,10
  
 
==See Also==
 
==See Also==
 
*[[TIAAdd]]
 
*[[TIAAdd]]
 +
*[[TIASubtractEx]]
 +
*[[TIAMultiplyEx]]
 +
*[[TIADivideEx]]
  
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:TIA Functions]]
 
[[Category:TIA Functions]]
 
[[Category:Array Functions]]
 
[[Category:Array Functions]]
 +
[[Category:Math Functions]]

Latest revision as of 17:34, 12 December 2012

Definition

procedure TIAAddEx(var TIA: TIntArray; const Values: TIntArray);

Availability

SCAR Divi 3.38 > Current

Description

Adds the values from the TIntArray Values to the values in TIA. The functions alternates between the values in Values. When Values is empty, TIA remains unchanged.

Examples

Example 1

var
  TIA: TIntArray;
  
begin
  TIA := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
  TIAAddEx(TIA, [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]);
  WriteLn(TIAToStr(TIA));
end.

Output:

9,9,9,9,9,9,9,9,9,9

Example 2

var
  TIA: TIntArray;
  
begin
  TIA := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
  TIAAddEx(TIA, [2, 1]);
  WriteLn(TIAToStr(TIA));
end.

Output:

2,2,4,4,6,6,8,8,10,10

See Also