PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, December 17, 2022

[FIXED] What is the meaning of parameters starting with tilde ~ in functions?

 December 17, 2022     ocaml, syntax     No comments   

Issue

What is the meaning of parameters starting with tilde ~ in functions, like in the this example:

let draw_line ~img ~color ~p0:(x0,y0) ~p1:(x1,y1) = ...

Solution

They are named parameters where the label is the same as the formal parameter name:

# let divide ~num ~den = num /. den;;
val divide : num:float -> den:float -> float = <fun>
# divide ~den:10.0 ~num:30.0;;
- : float = 3.

This is described under function definition here.



Answered By - Jeffrey Scofield
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing