0 people like it.

LiteMedia_Example1_BasicSyntax

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
// Define area of a rectangle
let area w h = w * h

// Define half of a value
let half x = x / 2

// Triangle area is half of it's rectangle
let triangleArea w h = half (area w h)

// Calculate triangle area with w=2; h=4
let myTriangle = triangleArea 2 4
val area : w:int -> h:int -> int

Full name: Script.area
val w : int
val h : int
val half : x:int -> int

Full name: Script.half
val x : int
val triangleArea : w:int -> h:int -> int

Full name: Script.triangleArea
val myTriangle : int

Full name: Script.myTriangle
Raw view Test code New version

More information

Link:http://fssnip.net/3N
Posted:15 years ago
Author:
Tags: