Skip to content

Language Basics

Nubo is a simple, expressive, real-time language with a syntax inspired by Go and JavaScript. This guide walks you through the basic constructs.

Use let or const to declare variables:

let name = "Martin"
const age = 18 // not mutable

Functions are declared with the fn keyword:

fn greet(name) {
return <h1>Hello, {name}!</h1>
}
if age >= 18 {
return <p>Adult</p>
} else {
return <p>Minor</p>
}
let inx = 0
while inx < 10 {
println(inx+1)
inx++
}

Supports both item-only and index+item syntax:

for item in range(3) {
println(item)
}
for i, item in list {
println(i, item)
}

Nubo lets you embed HTML natively:

let name = "World"
return <h1>Hello, {name}!</h1>

To render raw HTML (not escaped), prefix with @:

let html = <b>bold</b>
return <div>@{html}</div>

You can use built-in components like this:

import styled from "@std/styled"
let user = nubo.User{ Name: "Martin" }
return <styled.AdminDashboard :user="user">
<styled.H1>Hello, {user.Name}!</styled.H1>
</styled.AdminDashboard>

More advanced features are covered in later sections.