Method

# Oct

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Returns as a `string</api/data_types/string>`, the octal version of the number passed.

## Usage

``` xojo
result = Oct(value)
```

| Part   | Type                               | Description                            |
|--------|------------------------------------|----------------------------------------|
| result | `String</api/data_types/string>`   | The *value* passed converted to octal. |
| value  | `Integer</api/data_types/integer>` | The number to be converted to octal.   |

## Notes

If the *value* is not a whole number, the decimal value will be truncated.

VB Compatibility Note: VB rounds the value to the nearest whole number so the <span class="title-ref">Oct</span> function will probably be changed in a future release to do this as well.

You can specify binary, hex, or octal numbers by preceding the number with the & symbol and the letter that indicates the number base. The letter b indicates binary, h indicates hex, and o indicates octal.

## Sample code

Here are examples of various numbers converted to octal:

``` xojo
Var octVersion As String
octVersion = Oct(5) ' returns "5"
octVersion = Oct(75) ' returns "113"
octVersion = Oct(256) ' returns "400"
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`&b</api/language/literals/b>`, `&h</api/language/literals/h>`, `&o</api/language/literals/o>` literals, `Bin</api/text/bin>`, `Hex</api/text/hex>`, `Integer.FromOctal<integer.fromoctal>`, `Integer.ToOctal<integer.tooctal>` functions.

</div>
