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 ==, !=.
true && false == false
true || false == trueInt
The Int type represents a 64-bit integer. It supports the operators +, -, * as well as ==, !=, <, <=, >, >=.
1 + 3 == 4
1 < 3 == trueFloat
The Float type represents a 64-bit floating point number. It has support for the same operators as Int.
1.0 + 2.0 == 3.0String
The String type represents a string of characters. It has support for the operators + (concatenation) as well as ==, !=.
"hello" + " " + "world" == "hello world"Array
The Array type represents an array of a given type. Arrays correspond to lists in Python, slices in Go and arrays in TypeScript/JavaScript.
["a", "b", "c"].join(", ") == "a, b, c"Record
The Record type represents a collection of named fields. Records are defined at the outermost scope of a hop module. Records correspond to data classes in Python, structs in Go and objects in TypeScript/JavaScript.
record User {
name: String,
}
<Example {user: User}>
<if {user.name == "Tobi"}>
Found!
</if>
</Example>