previous | index | next

Conditional Execution

While Racket has if expressions, C++ has if statements.

Compare:

Racket C++
(define tax  
  (lambda (income)  
    (if (< income 10000)   
        0   
        (* 20/100 income))))
double tax(double income) {
  if ( income < 10000 )
    return 0.0;
  else
    return income * 0.20;
}


previous | index | next