Built-in Functions¶
Types of built-in functions¶
Built-in functions are the functions that are built into the language. They are used to perform common tasks. In Radon, there are a list of built-in functions that are available to use.
They are:
Utility methods¶
cls()
- clears the screen.clear()
- clears the screen.exit()
- exits the program.
Shell commands¶
help(obj)
- get help about any objectlicense()
- show project licensecredits()
- show project credits
Same as import
statement¶
require()
- same as include statement to include a file or library in the current program.
Command line arguments¶
sys_args()
- returns the command line arguments.
API methods¶
pyapi(string,ns)
- A high-level Python API for Radon. It is used to call Python functions from Radon.
Typecase methods¶
int()
- converts any value to an integer.float()
- converts any value to a float.str()
- converts any value to a string.bool()
- converts any value to a boolean.type()
- returns the type of the value.
Type checker methods¶
is_num()
- returnstrue
if the value is a number, otherwisefalse
.is_int()
- returnstrue
if the value is an integer, otherwisefalse
.is_float()
- returnstrue
if the value is a float, otherwisefalse
.is_str()
- returnstrue
if the value is a string, otherwisefalse
.is_bool()
- returnstrue
if the value is a boolean, otherwisefalse
.is_array()
- returnstrue
if the value is an array, otherwisefalse
.is_fun()
- returnstrue
if the value is a function, otherwisefalse
.
String methods¶
str_len()
- returns the length of the string.str_find(string, index)
- returns the character at the specified index.str_slice(string, start, end)
- returns the substring from the specified start index to the specified end index.
I/O methods¶
print()
- prints the specified value to the console.print_ret()
- prints the specified value to the console and returns the value.input()
- reads a line from the console.input_int()
- reads an integer from the console.
Array methods¶
arr_len()
- returns the length of the array.arr_push(array, item)
- adds an item to the end of the array.arr_pop(array, index)
- removes an item from the end of the array.arr_append(array, item)
- adds an item to the end of the array.arr_extend(array1, array2)
- adds all the items of an array to the end of the array.arr_find(array, index)
- returns the item at the specified index.arr_slice(array, start, end)
- returns the items from the specified start index to the specified end index.