I'm working with a code, but having some problems. "out" for "Tension" works fine, and is in the 1st method ("void"), but "Pivot" is passed on from the 1st method to the 3rd. The 2nd, 3rd and 4th methods are "double" ( and has to be for "Tension" to assign it's calculation in the 1st method ("void") ). I've tried to add "out" to "Pivot" to the 1st method, and pass it on to the other "double" methods.
The use of "out" for "Pivot" on the 1st method only reports this error: " Use of unassigned out parameter 'Pivot'' ". This is when I use " public void CreateTension( out double Tension, double Span_A, double Span_B, out int Pivot ) ", and leaves " Tension = CreateGannSplitUp( Ratio, Pivot ); " without " out Pivot " in the 1st method. If I pass "out" from the 1st to the 3rd method ( which is shown in the code below ), I get this error: " The out parameter 'Pivot' must be assigned to before control leaves the current method ".
Note: I use "out" for "Pivot" to get the value out of the 1st method ( but the whole issue is that "Pivot" is assigned to in the 3rd method ). The 1st method is the one I use to trigger the code ( the rest is triggered from the 1st method automatically ). This is how the code has to be.
The code triggers the 1st method first below, and triggers one by one upwards.
Code: Select all
// 4th Method
public static double CreateGannPercent( double Ratio, double L0, double L1 )
double Percent = ( Ratio - L0 ) / ( L1 - L0 );
// 3rd Method:
// Here PIVOT is supposed to be assigned!
// Pivot is not passed on with "out" to the next method, which is the last one, at " Tension = CreateGannPercent( Ratio, L1 + Counter, L1 + L2 + Counter ); ".
public double CreateGannRatio( double Ratio, double L1, out int Pivot )
// Code for ratio and PIVOT ( and L1 )!
Tension = CreateGannPercent( Ratio, L1 + Counter, L1 + L2 + Counter );
Pivot = Pivot_Number;
// 2nd Method:
public double CreateGannSplitUp( double Ratio, out int Pivot )
// Code for ratio ( and Increment "I" ).
Tension = CreateGannRatio( Ratio, I, out Pivot );
// 1st Method:
// Use of "out" here should be fine. Use of "out" at " Tension = CreateGannSplitUp( Ratio, Pivot ); " for passing it on to other methods is another question.
public void CreateTension( out double Tension, double Span_A, double Span_B, out int Pivot )
// Code for ratio.
Tension = CreateGannSplitUp( Ratio, out Pivot );
Johannes Hillestad Baumann