Skip to content

Commit 0f76b2e

Browse files
committed
Add VAL documentation
Also fix links in STR doc
1 parent a6ca7db commit 0f76b2e

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

docs/str.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ PRINT STR(a + 1)
2828

2929
* [CHR](chr.md)
3030
* [CODE](code.md)
31-
* [STR](str.md)
3231
* [VAL](chr.md)

docs/val.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#VAL
2+
3+
##Syntax
4+
5+
6+
```
7+
VAL(<string value>)
8+
```
9+
10+
##Description
11+
12+
Converts the given numeric string value into its numeric value. It's the opposite of [STR](str.md).
13+
If the string can be converted into a number, [PEEK](peek.md) 23610 (ROM ERR_NR variable) will return 255 (_Ok_).
14+
15+
On the other side, if expression cannot be parsed (i.e. it's not a valid number expression), 0 will be returned,
16+
and [PEEK](peek.md) 23610 (ROM ERR_NR variable) will return 9 (_Invalid Argument_).
17+
18+
Returned value type is [Float](types.md#float).
19+
20+
##Examples
21+
22+
```
23+
REM Convert numeric expression to value
24+
LET a$ = "-55.3e-1"
25+
PRINT "Value of "; a$; " is "; VAL(a$)
26+
LET a$ = "aaa"
27+
PRINT "Numeric value of "; a$; " is "; VAL(a$): REM prints 0
28+
```
29+
30+
##Remarks
31+
32+
* This function is 100% Sinclair BASIC Compatible
33+
34+
##See Also
35+
36+
* [CHR](chr.md)
37+
* [CODE](code.md)
38+
* [STR](str.md)

0 commit comments

Comments
 (0)