Đang chuẩn bị liên kết để tải về tài liệu:
Foundations of F#.Net phần 2
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'foundations of f#.net phần 2', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | CHAPTER 3 FUNCTIONAL PROGRAMMING 17 The words listed next are not currently F keywords but have been reserved for possible future use. It is possible to use them as identifiers or type names now but the compiler will issue a warning if you do. If you care that your code is compatible with future versions of the compiler then it is best to avoid using them. I will not use them in the examples in this book. async method atomic mixin break namespace checked object component process const property constraint protected constructor public continue pure decimal readonly eager return enum sealed event switch external virtual fixed void functor volatile include where If you really need to use a keyword as an identifier or type name you can use the double back quote syntax let class style The usual reason for doing this is when you need to use a member from a library that was not written in F and that uses one of F s keywords as a name you ll learn more about using non-F libraries in Chapter 4 . The best practice is to avoid using keywords as identifiers if possible. Literals Literals represent constant values and are useful building blocks for computations. F has a rich set of literals summarized in Table 3-1. 18 CHAPTER 3 FUNCTIONAL PROGRAMMING Table 3-1. F Literals Example F Type .NET Type Description Hello t World n string System.String A string in which a backslash is an escape character @ c dir fs @ string System.String A verbatim string where a backslash is a regular character bytesbytesbytes B byte array System.Byte A string that will be stored as a byte array c char System.Char A character true false bool System.Boolean A Boolean 0x22 int int32 System.Int32 An integer as a hexadecimal 0o42 int int32 System.Int32 An integer as an octal 0b10010 int int32 System.Int32 An integer as a binary 34y sbyte System.SByte A signed byte 34uy byte System.Byte An unsigned byte 34s int16 System.Int16 A 16-bit integer 34us uint16 System.UInt16 An unsigned 16-bit integer 34l int .