首页 > 其他 > 详细

【F#】 入门代码

时间:2015-07-06 19:30:30      阅读:319      评论:0      收藏:0      [点我收藏+]

找下感觉: 语法和go 如出一辙, 都是erlang派的语言

在 vs 中我没有找到自动缩进的快捷键

github上的F#代码也相对较少

//http://fsharp.org 上了解有关 F# 的更多信息  
// 请参阅“F# 教程”项目以获取更多帮助。
open System

//2. 相当于一个类实体
type internal Person = {
    id: int
    name: string
    parent: int
}
// 
type internal User = {
    id: int
    name: string 
}

let hellofunc() =
    Console.WriteLine "hello word"
    let hh = Console.ReadKey(true)
    //3. personobj 是根据相同结构确定定义的对象吗?
    let personobj = {
        id= 1
        name = "f#"
        parent = 7 
         }
    //是这样的(我还是喜欢直接写代码  后看理论)
    let user = {
        id = 1
        name = "username"
    }
    Console.WriteLine personobj.name
    Console.WriteLine hh.Key
    let hhh = Console.ReadLine
    0

//1. 用“EntryPointAttribute”特性标记的函数必须是编译序列中最后一个文件中的最后一个声明,并且只能在编译为 .exe 时才可使用    
//f#是从上往下编译的
//那么文件依赖有顺序吗?
[<EntryPoint>]
let main argv =  
    hellofunc()

 

接下来深喉+直捣黄龙,来看看高并发多线程下F#有何玄机:

 

【F#】 入门代码

原文:http://www.cnblogs.com/viewcozy/p/4625027.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!