Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
Syntax
Value.As(value as any, type as type) as any
About
Returns the value if it's compatible with the specified type. This is equivalent to the "as" operator in M, with the exception that it can accept identifier type references such as Number.Type.
Example 1
Cast a number to a number.
Usage
Value.As(123, Number.Type)
Output
123
Example 2
Attempt to cast a text value to a number.
Usage
Value.As("abc", type number)
Output
[Expression.Error] We cannot convert the value "abc" to type Number.