[ReasonML] Named & optional params
amp named optional params
2023-09-14 08:59:17 时间
// ::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 ()
相关文章
- Spring 全家桶之 Spring Web MVC(三)- View & ViewResolve
- C++ 类构造函数&解析函数
- spring项目健康 & IDEA使用
- 【JDK8 新特性 7】并行的Stream流¶llelStream背后的技术
- 击败申真谞陪练的围棋AI,却输给了业余人类棋手 | MIT&伯克利新研究
- CVPR2022|谷歌 实时3D人体关键点检测&姿态估计,已加入mediapipe!论文速递2022.9.14!
- CentOS python3 & Java 安装
- 7 Papers & Radios | ICLR 2023杰出论文奖;微软GPT-4完整测评
- 正则用(?>…)实现固化分组提高效率
- Android控件系列之相册Gallery&Adapter适配器入门&控件缩放动画入门