Documentation
¶
Overview ¶
Package datavalue provides the Value type and related methods.
Index ¶
- type Value
- func (v Value) AsArray() ([]Value, error)
- func (v Value) AsBool() (bool, error)
- func (v Value) AsError() (error, error)
- func (v Value) AsFunction() (*ast.FuncDeclarationStatement, error)
- func (v Value) AsNumber() (float64, error)
- func (v Value) AsString() (string, error)
- func (v Value) AsTuple() ([]Value, error)
- func (v Value) Equals(other Value) bool
- func (v Value) IsTruthy() bool
- func (v Value) ToString() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Value ¶
type Value struct {
DataType datatype.DataType
Num float64
Str string
Bool bool
Func *ast.FuncDeclarationStatement
Values []Value
Error error
Any any
}
Value represents a value in the language.
func Function ¶ added in v0.1.1
func Function(fn *ast.FuncDeclarationStatement) Value
Function creates a new function value.
func (Value) AsFunction ¶ added in v0.1.1
func (v Value) AsFunction() (*ast.FuncDeclarationStatement, error)
AsFunction returns the value as a function.
Click to show internal directories.
Click to hide internal directories.