Jump to content

  •  

Photo

Creating Functions

Code Snippet

  • Please log in to reply
No replies to this topic

#1 Wilson18

Wilson18

    Administrator

  • root
  • 112 posts
  • LocationUniversity of Birmingham

Posted 02 November 2014 - 08:57 PM

If you are doing a calculation multiple times but only need to make a change to one of its variables, you can do this as a function. An example of a use of this and how it can be converted in to a function

let circumference radius = 2.0 *. 3.14159265359  *. radius;;

circumference 10.0;;

The above function is called circumference and accepts a parameter of radius. You can see how this is called by the second line.

 

Attached File  Screen Shot 2014-11-02 at 20.56.21.png   43.08KB   0 downloads


List what you read?

Check me out on: YouTube, Twitter, Facebook, Google+






Also tagged with one or more of these keywords: Code Snippet