# Introduction

## What is Starlark?

Starlark is a small subset of Python developed by Google for their Bazel build system. If you know Python, it should be easy to learn.

### Example code

> The code below is an example of the syntax of Starlark. If you've ever used Python, this should look very familiar. In fact, the code above is also a valid Python code. Still, this short example shows most of the language. Starlark is indeed a very small language. - Starlark README.md

{% code title="From Starlark README.md" %}

```python
# Define a number
number = 18

# Define a dictionary
people = {
    "Alice": 22,
    "Bob": 40,
    "Charlie": 55,
    "Dave": 14,
}

names = ", ".join(people.keys())  # Alice, Bob, Charlie, Dave

# Define a function
def greet(name):
    """Return a greeting."""
    return "Hello {}!".format(name)

greeting = greet(names)

above30 = [name for name, age in people.items() if age >= 30]

print("{} people are above 30.".format(len(above30)))

def fizz_buzz(n):
    """Print Fizz Buzz numbers from 1 to n."""
    for i in range(1, n + 1):
        s = ""
        if i % 3 == 0:
            s += "Fizz"
        if i % 5 == 0:
            s += "Buzz"
        print(s if s else i)

fizz_buzz(20)
```

{% endcode %}

### More Starlark documentation

* [Language specification](https://github.com/bazelbuild/starlark/blob/master/spec.md) (Bazel)
* [Language specification](https://github.com/google/starlark-go/blob/master/doc/spec.md) (starlark-go)

## Modules

We have a few modules available that are available in the global scope. See [Modules](#modules) for more information.
