24
loading...
This website collects cookies to deliver better user experience
//if the function the double the number
double x = x + x;
//if we call this function with a number
double 4
//It replaces by the body of the function "x + x" with argument
double 4 => 4 + 4
//so the answer is 8
//the function double the number
double x = x + x;
//the function average the two number
average x y = (x + y) / 2;
//so the function double change into
double x = plus x x //change expression num1 + num2
//so the function average change into
average x y = divide (plus x y) 2 //change expression num1 / num2
double (average 2 4) =>
plus (average 2 4) (average 2 4) =>
plus (divide (plus 2 4) 2) (average 2 4) =>
plus (divide 6 2) (average 2 4) =>
plus 3 (average 2 4) =>
plus 3 (divide (plus 2 4) 2) =>
plus 3 (divide 6 2) =>
plus 3 3 =>
6
double (average 2 4) =>
double (divide (plus 2 4) 2) =>
double (divide 6 2) =>
double 3 =>
plus 3 3 =>
6
24