Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Newbie question about type (and syntax?)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Remi VANICAT <vanicat@l...>
Subject: Re: [Caml-list] Newbie question about type (and syntax?)
Johann Spies <jhspies@adept.co.za> writes:

> I am working through a tutorial and typing in the following example
> produced an error:
> 
> -------------------------------
> let rec power i x =
>         if i = 0 then
>                 1
>         else
>         x *. (power (i-1) x);;
> This expression has type float but is here used with type int
> -------------------------------------------------------
> 
> I can not see why it is an error and how to correct the code coming
> from the tutorial.

1 is an int. it's the problem, you should use 1. (after the then)

-- 
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr