Navigation Menu

Skip to content

Commit

Permalink
Correct misattributed string() details (#222)
Browse files Browse the repository at this point in the history
* Correct misattributed `string()` details
  • Loading branch information
bbuck authored and geseq committed Oct 24, 2019
1 parent 1ee7425 commit c3e41c2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/builtins.md
Expand Up @@ -50,20 +50,20 @@ type_name("str") // string
type_name([1, 2, 3]) // array
```

## string

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.
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
v = string(undefined, "foo") // v == "foo"
v = string(undefined, false) // v == false
x := string(123) // x == "123"
```

## 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.
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.

```golang
x := string(123) // v == "123"
v = string(undefined, "foo") // v == "foo"
v = string(undefined, false) // v == false
```

## int
Expand Down

0 comments on commit c3e41c2

Please sign in to comment.