View difference between Paste ID: ZQ19Cu87 and bhFEFxiN
SHOW: | | - or go back to the newest paste.
1
/// approach(start, ending, difference);
2
var start, ending, difference;
3
 
4
start = argument0;
5
ending = argument1;
6
difference = argument2;
7
 
8
var result;
9
 
10
if (start < ending){
11
    result = min(start + difference, ending);
12
}else{
13
    result = max(start - difference, ending);
14
}
15
 
16
return result;