Version française
Home     About     Download     Resources     Contact us    
Browse thread
Optional arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Serguei Ouklonski <Sergeiu@o...>
Subject: Optional arguments
Hi,

Example1:

let fn1 a:string (?b = "") = (String.length a) + (String.length b)

let x = fn1 "test"

  result is function

Example2:

let fn1 (?a = "") b:string = (String.length a) + (String.length b)

let x = fn1 "test"

  result is 4 (number)


It seems that in both cases result should be 4.

Have I missed something from OCaml docs?


Regards

Serguei Ouklonski