Skip to content

Expressions

This page contains a reference of the types of the expressions that exist in hop.

Bool

The Bool type represents the boolean values true and false. The boolean values support the operators !, &&, || as well as ==, !=.

hop-expr
true && false == false
true || false == true

Int

The Int type represents a 64-bit integer. It supports the operators +, -, * as well as ==, !=, <, <=, >, >=.

hop-expr
1 + 3 == 4
1 < 3 == true

Float

The Float type represents a 64-bit floating point number. It has support for the same operators as Int.

hop-expr
1.0 + 2.0 == 3.0

String

The String type represents a string of characters. It has support for the operators + (concatenation) as well as ==, !=.

hop-expr
"hello" + " " + "world" == "hello world"

Array

The Array type represents an array of a given type. Arrays are backed by lists in Python, slices in Go and arrays in TypeScript/JavaScript.

hop-expr
["a", "b", "c"].join(", ") == "a, b, c"

Record

The Record type represents a collection of named fields. Records are declared at the top level scope of a hop module. Records are backed by data classes in Python, structs in Go and objects in TypeScript/JavaScript.

hop
record User {
  name: String,
}

<Example {user: User}>
  {user.name}
</Example>

<Example {user: User(name: "Tobi")} />