Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //1+2 |> ignore
- //let a = 4 * 6
- //let raisePowerTwo x = x ** 2.0
- //let y = raisePowerTwo 3.0
- //let s = @"apple\n"
- //let c : System.Char = 'X'
- //let b = true
- //printfn "%.3f" 5.0
- //printfn "%A" "apple"
- //let add a b = a + b
- //let addFour = add 4
- //
- //addFour 7
- //
- //let add4 b = 4 + b
- //
- //let add2 (a, b) = a + b
- //
- //add2 (4,7)
- //
- //let halfway a b=
- // let dif = b - a
- // let mid = dif / 2
- // mid + a
- //
- //halfway 5 11
- //halfway 11 5
- //let halfway5 = halfway 5
- //halfway5 11
- //let defineMessage () =
- // let message = "Hello"
- // printfn "%s" message
- // let message = "Hi"
- // printfn "%s" message
- //
- //defineMessage ()
- //
- let mathsPuzzle () =
- printf "Enter the day of the month on which you were born: "
- let input = int ( System.Console.ReadLine() )
- let x = input * 4
- let x = x + 13
- let x = x * 25
- let x = x - 200
- printf " Enter number of the month you were born: "
- let input = int ( System.Console.ReadLine() )
- let x = x + input
- let x = x * 2
- let x = x - 40
- let x = x * 50
- printf " Enter the last two digits of the year of your birth:"
- let input = int ( System.Console.ReadLine() )
- let x = x + input
- let x = x - 10500
- printf "Date of birth (ddmmyy): %i" x
- mathsPuzzle ()
- let changeType () =
- let x = 1
- let x = "change me"
- let x = x + 1
- printf "%s" x
- let rec fact x =
- if x = 0 then
- 1
- else
- x * fact ( x - 1 )
- fact 5
- let rec fib n =
- match n with
- | 0 -> 0
- | 1 -> 1
- | x -> fib ( x - 1 ) + fib ( x - 2 )
- fib 10
- let add a b = a + b
- let add2 = fun a b -> a + b
- let add3 = fun a -> (fun b -> a + b)
- let add4 = function a -> function b -> a + b
- let f = function
- | x when x < 10 -> "less than 10"
- |_ -> "not less than 10"
- let f2 = fun x ->
- match x with
- | x when x < 10 -> "less than 10"
- |_ -> "not less than 10"
- let s = "one, " ^ "two, " ^ "three"
- let date = System.DateTime.Now + new System.TimeSpan( 365, 0, 0, 0 )
- let (+) a b = a - b
- 4 + 5
- "apple" + "pie"
- let (+*) a b = (a+b)*a*b
- let x = 34 +* 3
- let list1 = []
- let list2 = 1 :: []
- let list3 = 1 :: 2 :: []
- let list4 = [1;2;3;4]
- let list5 = [1; 2 ] @ [ 3; 4; 5; 6 ]
- let rec print_elements list =
- match list with
- | [] -> ()
- | head :: tail ->
- printfn "%A" head
- print_elements tail
- print_elements [1; 2; 3; 4]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement