标签:nbsp output call where function col put amp fun
// ::country is named param // ::country=?: which make it optional // because we make ::country=? optional named param, we may pass in or may not pass in // we need use ‘()‘ --> (): string => , which is unit, to call the function let rock (::country=?) (song: string) (times: int) () :string => switch country { | None => {j|Rocked out to $(song) $(times) times somewhere |j} | Some g => {j|Rocked out to $(song) $(times) times in $(g) |j}; }; let output = rock "Nad Tatrou sa blýska" 1 (); // call ()unit the function let output2 = rock "Nad Tatrou sa blýska" 1 country::"fff" (); // pass the country::"China" and then call the function ()
[ReasonML] Named & optional params
标签:nbsp output call where function col put amp fun
原文地址:http://www.cnblogs.com/Answer1215/p/7745827.html