previous
|
index
|
next
Example
Compare:
Racket
C++
(
define
square
(
lambda
(
x
)
(
* x x
)))
double
square
(
double
x
)
{
return
x
*
x
;
}
The keyword
double
specifies a
type
, namely a double precision floating point number
First use: the type of the function's return value
Second use: the type of the function's argument
x
The keyword
return
specifies the function's return
value
;
if you forget it the function will return a null value.
previous
|
index
|
next