Skip to content
Andrew edited this page Apr 17, 2014 · 2 revisions

clamp

Limits the value to a range with an upper and a lower bound.

Overrides:

  • clamp:int (value:int min:int max:int)
  • clamp:float (value:float min:float max:float)
  • clamp:long (value:long min:long max:long)
  • clamp:double (value:double min:double max:double)

fail

Throws a new Exception with given message.

  • fail:unit (msg:string)

fmt

Formats a string. Is a shorthand to string::Format.

  • fmt:string (s:string x1:obj...)

print

Prints a string to the console with optional formatting. Is a shorthand for Console::Write.

println

Prints a string to the console with optional formatting and a newline character. Is a shorthand for Console::WriteLine.

rand

Returns a random value.

Overrides:

  • rand:double - returns a random double from 0.0 to 1.0
  • rand:int (max:int) - return a random int from 0 to max
  • rand:int (min:int max:int) - return a random int from min to max
  • rand:T (src:IList<T>) - return a random item from the collection
  • rand:T (src:IList<T> w:Func<T, double>) - return a random item from the collection by a weighter function

read

Reads a single character from the console and returns its character key. Is a shorthand for Console::Read.

  • read:int

readkey

Reads a single keypress from the console. The key is displayed. Is a shorthand for Console::ReadKey (false).

  • readkey:ConsoleKeyInfo

readln

Reads a string from the console until a newline character is entered. Is a shorthand for Console::ReadLine.

  • readln:string

times

An extension method for invoking a lambda several times.

Overrides:

  • times:unit (x:int act:Action)
  • times:unit (x:int act:Action<int>) - accepts the index

to

Returns a sequential range of values between two points. A step can also be provided.

Overrides:

  • to:IEnumerable<int> (from:int to:int)
  • to:IEnumerable<int> (from:int to:int step:int)
  • to:IEnumerable<string> (from:string to:string)
  • to:IEnumerable<string> (from:string to:string step:int)

Is used as an extension method:

let nums = 1.to 10
let chars = "A".to "Z"

For the string overrides, the from and to arguments must be one-character strings. Otherwise an ArgumentException is issued!

waitkey

Reads a single keypress from the console. The key is not displayed. Is a shorthand for Console::ReadKey (true).

  • readkey:ConsoleKeyInfo
Clone this wiki locally