-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Section 02 12: Summary of the basic types.
- Loading branch information
1 parent
f9bd885
commit 35ebe8c
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
namespace FPinFSharp.Exercises.Chapter_02 | ||
|
||
// 2.12 Summary of the basic types | ||
module Section_02_12 = | ||
|
||
let getChar () : char = 'c' | ||
|
||
let getByte isHex : byte = | ||
match isHex with | ||
| true -> 0xFFuy | ||
| false -> 255uy | ||
|
||
let getSByte isHex : sbyte = | ||
match isHex with | ||
| true -> -0x80y | ||
| false -> 127y | ||
|
||
let getInt16 isHex : int16 = | ||
match isHex with | ||
| true -> -0x8000s | ||
| false -> 32767s | ||
|
||
let getUInt16 isHex : uint16 = | ||
match isHex with | ||
| true -> 0xFFFFus | ||
| false -> 65535us | ||
|
||
let getInt32 isHex : int32 = | ||
match isHex with | ||
| true -> -0x80000000 | ||
| false -> 2147483647 | ||
|
||
let getUInt32 isHex : uint32 = | ||
match isHex with | ||
| true -> 0xFFFFFFFFu | ||
| false -> 4294967295u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters