Built-in Functions

I/O Functions

print(value)

Outputs a value to the console.

print "Hello"
print 42

input(prompt)

Reads user input from the console.

let name = input("Enter your name: ")
print name

Type Conversion Functions

str(value)

Converts a value to a string.

let num = 42
let text = str(num)

int(value)

Converts a value to an integer.

let text = "123"
let num = int(text)

type(value)

Returns the type name of a value as a string.

print type(42)        # Prints: int
print type("hello")   # Prints: str

Utility Functions

len(value)

Returns the length of a string or list.

let text = "FlowLang-Script"
print len(text)  # Prints: 15

range(start, end)

Creates a list of integers from start (inclusive) to end (exclusive).

let numbers = range(1, 5)
print numbers  # Prints: [1, 2, 3, 4]

HTTP Functions

http_get(url)

Performs an HTTP GET request and returns the response.

let data = http_get("https://jsonplaceholder.typicode.com/users/1")
print data

Features:

  • Automatic JSON parsing when possible
  • Returns dictionary for JSON responses
  • Returns string for plain text responses
  • Error handling with error messages

http_post(url, data)

Performs an HTTP POST request with JSON data.

let response = http_post("https://api.example.com/data", {"key": "value"})
print response

File I/O Functions

read_file(path)

Reads and returns the contents of a file.

let content = read_file("data.txt")
print content

write_file(path, content)

Writes content to a file.

let result = write_file("output.txt", "Hello, World!")
print result  # Prints: Written to output.txt

Function Reference Table

FunctionCategoryDescription
print(value)I/OOutput to console
input(prompt)I/ORead user input
str(value)ConversionConvert to string
int(value)ConversionConvert to integer
type(value)UtilityGet type name
len(value)UtilityGet length
range(start, end)UtilityCreate number list
http_get(url)HTTPGET request
http_post(url, data)HTTPPOST request
read_file(path)File I/ORead file
write_file(path, content)File I/OWrite file