## 1.1. Simple Expressions

This section shows how to write some simple Orc expressions. Simple expressions publish at most one value, and do not recursively contain other expressions. We will see later how some of these cases may also be used as complex expressions.

### 1.1.1. Values

The simplest expression one can write is a literal value. Executing that expression simply publishes the value.

Orc has four kinds of literal values:

• Booleans: `true` and `false`
• Numbers: ` 5, -1, 2.71828, ... `
• Strings: `"orc"`, `"ceci n'est pas une |"`
• A special value `signal`.

### 1.1.2. Operators

Orc has a standard set of arithmetic, logical, and comparison operators. As in most other programming languages, they are written in the usual infix style. They have Java-like operator precedence, which can be overridden by adding parentheses.

Examples

• `1 + 2` publishes `3`.
• `(98 + 2) * 17` publishes `1700`.
• `4 = 20 / 5` publishes `true`.
• `3-5 >= 5-3 ` publishes `false`.
• `true && (false || true)` publishes `true`.
• `"leap" + "frog"` publishes `"leapfrog"`.
• `3 / 0` halts, publishing nothing.

### 1.1.3. Sites

An Orc program interacts with the external world by calling sites. Sites are one of the two fundamental concepts of Orc programming, the other being combinators which we discuss later when covering complex expressions.

A site call in Orc looks like a method, subroutine, or function call in other programming languages. A site call might publish a useful value, or it might just publish a `signal`, or it might halt, refusing to publish anything, or it might even wait indefinitely. Here are some examples:

Examples

• `Println("hello world")` prints `hello world` to the console and publishes a `signal`.
• `Random(10)` publishes a random integer from 0 to 9, uniformly distributed.
• `Browse("http://orc.csres.utexas.edu/")` opens a browser window pointing to the Orc home page and publishes a `signal`.
• `Error("I AM ERROR")` reports an error message on the console, and halts. It publishes nothing.
• `Rwait(420)` waits for 420 milliseconds, then publishes a `signal`.
• `Prompt("Username:")` requests some input from the user, then publishes the user's response as a string. If the user never responds, the site waits forever.

Even the most basic operations in Orc are sites. For example, all of the operators are actually sites; `2+3` is just another way of writing the site call `(+)(2,3)`.

By convention, all site names begin with a capital letter.