I want between two $iMin and $iMax numbers to choose a number $iSelectNumber and whenever the user gives a number $iInputNumber, the $iMin and the $iMax to dynamically change as many times as necessary. Example: between 1 and 100 to choose 67. Step1. Range: 1 -100 Step2. InputNumber: 70 -> Range: 1 – 70 Step3. InputNumber: 34 -> Range: 34 – 70 Step4. InputNumber: 55 -> Range: 55 - 70 Step5. InputNumber: 69 -> Range: 55 – 69 Stepn. .... I created the following function which returns the range properly the first time you call. Because the $iMin and the $iMax are fixed every time when call my function initializes the $iMinNew and the $iMaxNew and do not want it. Const $iMin = 1
Const $iMax = 100
Const $iSelected = 67
Func _Range($iInputNumber, $iSelected, $iMin, $iMax)
; Returns the range of the numbers in which the selected number included
Local $aRange[2]
Local $iMinNew = $iMin
Local $iMaxNew = $iMax
If $InputNumber < $iSelected Then
$aRange[0] = $iInputNumber
$aRange[1] = $iMaxNew
$iMinNew = $iInputNumber
Else
$aRange[0] = $iMinNew
$aRange[1] = $iInputNumber
$iMaxNew = $iInputNumber
EndIf
Return $aRange
EndFunc ;==>_Range I want a help in the algorithm.