> For the complete documentation index, see [llms.txt](https://sron.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sron.gitbook.io/docs/datatypes.md).

# Datatypes in SRON

### Data types represent the different kinds of values that variables and expressions can hold or represent.

***

### There are 10 datatypes available in SRON:

### 1. Int :

* Represents whole numbers without decimal parts.\\
* Examples include 0, 1, -5, 1000.\\
* Range of 'Int' is from **-9,223,372,036,854,775,808** to **9,223,372,036,854,775,807**.
* **'Int'** keyword is used to declare Int-type variables.

```js
{
    name : Main

    Int val = 10

    val = -155
}
```

***

### 2. Double :

* Represents numbers with fractional parts. It can hold upto 15 floating point decimal digits.
* Examples include 3.14, -0.001, 2.71828.
* Range of 'Double' is from **2.22507385850720138309023271733240406e-308** to **1.79769313486231570814527423731704357e+308**.
* 'Double' keyword is used to declare Double-type variables.

```js
{
    name : Main

    Double val = 10.548994

    val = -155.1256
}
```

***

### 3. Char :

* Represents single characters, such as letters, digits, and symbols. Character data types are used to store individual characters from a character set (e.g., ASCII, Unicode).
* Examples include A, B, \n , \t, 1, 2 etc.
* 'Char' keyword is used to declare Char-type variables and single apostrophe (') is used to make a Char-type values.

```js
{
    name : Main

    Char val = '\n'

    val = 'A'
}
```

***

### 4. String :

* Represents sequences of characters. Strings are used to store text or sequences of characters, such as words, sentences, or paragraphs.
* String-type values can contain only ASCII characters.
* 'String' keyword is used to declare String-type variables and quote mark (") is used to make a String-type values.

```js
{
    name : Main

    String val = "Programming is Fun"

    val = "Hello, SRON!"
}
```

***

### 5. Bool :

* Represents logical values of true or false. Boolean data types are commonly used in conditions and logical operations.\\
* Contains only two values 'true' or 'false'.
* 'Bool' keyword is used to declare Bool-type variables.

```js
{
    name : Main

    Bool val = true

    val = false
}
```

***

### 6. List :

* Represents a sequence of all the above data types in a single unit.
* It can even store a List type in itself also.
* List variables are declared using 'List' keyword and 'List' are declared using Square brackets '\[ ]'.

```js
{
    name : Main
    
    List val = [1, 123.456, 'A', "SRON", true]

    val = ["List", [1,2,3], false, -0.44, 99, Void]
}
```

***

### 7. Collective :

* We cannot directly call Collective a datatype because you cannot create its variable. In the internal functioning of SRON, the **'String'**, **'LiteralString'** and **'List'** types are the child types of Collective.
* In other words, Collective is a datatype which is able to store more than one value within itself. Like String which can store many characters within itself. List is also a collective type because it can store more than one values within itself.

***

### 8. FileReader :

* Used to read the content of a file in the secondary storage(or disk).
* FileReader variables are declared using 'FileReader' keyword.

```js
{
    name : Main
    
    @ this file cannot be read, 
    @ it is just a variable holding no file
    FileReader file

    @ to load a file, use freader() function
    file = freader("file.txt")

    Any file_content = freadWhole(file)

    println(file_content)
}
```

***

### 9. FileWriter :

* Used to write the content to a file in the secondary storage(or disk).
* FileWriter variables are declared using 'FileWriter' keyword.

```js
{
    name : Main
    
    @ this file cannot be write, 
    @ it is just a variable holding no file
    FileWriter file

    @ to write a file, use fwriter() function
    file = fwriter("file.txt", false)

    Any file_content = "Hi there! 27062003"

    fwriteString(file, file_content)

    fclose(file)
}
```

***

### 10. LiteralString :

* used to read the compile time strings without copying them.
* it is immutable so cannot perform changes to it's content.

```js
{
    name : Main
    
    LiteralString str1 = "Hello"

    Any str2 = "World"

    console : (str1, str2)
}
```

***
