diff --git a/docs/builtins.md b/docs/builtins.md index 4bb65a9..a512b6f 100644 --- a/docs/builtins.md +++ b/docs/builtins.md @@ -50,6 +50,14 @@ type_name("str") // string type_name([1, 2, 3]) // array ``` +## string + +Tries to convert an object to string object. See [Runtime Types](https://github.com/d5/tengo/blob/master/docs/runtime-types.md) for more details on type conversion. + +```golang +x := string(123) // x == "123" +``` + Optionally it can take the second argument, which will be returned if the first argument cannot be converted to string. Note that the second argument does not have to be string. @@ -58,14 +66,6 @@ v = string(undefined, "foo") // v == "foo" v = string(undefined, false) // v == false ``` -## string - -Tries to convert an object to string object. See [Runtime Types](https://github.com/d5/tengo/blob/master/docs/runtime-types.md) for more details on type conversion. - -```golang -x := string(123) // v == "123" -``` - ## int Tries to convert an object to int object. See [this](https://github.com/d5/tengo/blob/master/docs/runtime-types.md) for more details on type conversion.