TYPEOF
Root / Documentation / [.]
Created:
Check the type of a value.
* Syntax
```sbsyntax
TYPEOF value OUT type%
```
|* Input | Description |
| `value` | The value whose type to check. |
|* Output | Description |
| `type%` | The type of the value.\
{|* Value | Constant | Description |
| 0 | `#T_DEFAULT` | Default type |
| 1 | `#T_INT` | Integer |
| 2 | `#T_REAL`| Real number |
| 3 | `#T_STR` | String |
|||
| 5 | `#T_INTARRAY` | Integer array |
| 6 | `#T_REALARRAY` | Real number array |
| 7 | `#T_STRARRAY` | String array |} |
The default type `#T_DEFAULT` (also called "empty") is a special value used when arguments or return values from a function are unset.
* Examples
```sb4
'check type of this number
PRINT TYPEOF(0) '1
```
```sb4
'check type of this variable
VAR S$="ABC"
PRINT TYPEOF(S$) '3
```
```sb4
'demonstration of empty value
'the second argument to TEST is not passed
DEF TEST A,B
PRINT TYPEOF(A)
PRINT TYPEOF(B)
END
TEST 1,
```
No posts yet (will you be the first?)