Capy-Bearer Documentation

Get a dynamic value type name

lib call

Capy

function get_type_name(value : any) string

Description

get_type_name(value) reports the internal kind currently stored in an any. Both maps and lists report array. A callable reports unknown.

This function is different from expression::type_name. The expression form reports the resolved static Capy type. A value with static type any always reports any, even when it currently stores a string.

Parameters

value : value to inspect

Return Values

One of String, f64, bool, array, none, pointer, reference, or unknown.

Example

Capy

var value := any("text")
print(value::type_name, " ", get_type_name(value), "\n")

Output

any String