Skip to main content

Mastering Verse Primitive Types

Verse’s basic types fall into a clean set of primitives optimized for deterministic game logic in Unreal Editor for Fortnite (UEFN). This tutorial unpacks each primitive type and demonstrates how to apply them in real-world game scripts.


1. Numeric Types

Numbers form the foundation of gameplay logic—tracking positions, character stats, timers, and score thresholds.

A. int (Integer Numbers)

An int represents a whole number that can be positive, negative, or zero. At runtime, Verse integers support arbitrary precision. However, when you write literal numbers directly in your source code, they must fit within a standard 64-bit signed range. Standard arithmetic applies (+, -, *), but standard division (/) yields a rational type instead of an int.
Health : int = 100
Damage : int = 25
RemainingHealth := Health - Damage # Results in 75

B. float (Decimal Numbers)

A float handles fractional and decimal numbers using 64-bit IEEE-754 floating-point math. It includes native support for special IEEE values like NaN (Not a Number) and infinity. Use floats for precision systems like speed scalars, game timers, vectors, and physics calculations.
Speed : float = 3.5
TimeElapsed : float = 2.0
Distance := Speed * TimeElapsed # Results in 7.0

C. rational (Exact Fractions)

A rational type represents an exact fraction. It is generated automatically when you divide one int by another. Because it preserves exact fractional mathematics, it avoids the rounding errors common to floating-point numbers. The runtime normalizes fractions automatically, and int acts as a natural subtype of rational.
Half := 1 / 2         # rational fraction: 1/2
Third := 1 / 3        # rational fraction: 1/3
Rounded := Floor(Third) # Evaluates to 0

2. Logical Type

logic (Boolean Values)

The logic primitive represents a boolean state: either true or false. It controls conditions, execution branches, and state checks within game rules.
IsAlive : logic = true
HasKey : logic = false

if (IsAlive? and HasKey?):
    Print("Player can open the door!")
else:
    Print("Access denied.")

3. Text Types

Verse separates text into individual characters and full immutable strings.

A. char

A char represents a single 16-bit UTF-16 code unit, ideal for standard alphanumeric symbols.

B. char32

A char32 represents a full 32-bit Unicode scalar value. Use this type when dealing with extended characters, such as complex symbols or emojis.

C. string

A string is an immutable sequence of UTF-16 code units. It handles player names, on-screen messages, and UI text layout. Strings fully support structural string interpolation using curly braces {}.
Letter : char = 'A'
Emoji : char32 = '\u{1F600}' # ๐Ÿ˜€ 
PlayerName : string = "Joash"

Print("Welcome, {PlayerName}!")

4. Special Types

A. any

The any type acts as the universal supertype for all types in Verse. While it can store any value, using it strips away compile-time type safety. It is primarily utilized when constructing highly generalized containers or abstract frameworks.
var Varied : any = 42
set Varied = "Now I'm a string!"

B. void

The void type represents an empty type containing no values. It is explicitly used to define functions that execute side effects but return no meaningful output data back to the caller.
LogMessage() : void =
    Print("This function returns nothing.")

5. Intrinsic Functions

Intrinsic functions are low-level operations built directly into the Verse runtime rather than written in Verse code itself (e.g., Abs(), Floor()). Because they are bound directly to the runtime architecture, they cannot be stored inside variables or passed as functional parameters.
# Valid execution:
Result := Abs(-42) 

# Compiler Error:
# MyFunctionVariable := Abs 

Complete Blueprint: Combining Basic Types

The following script brings all of these fundamental primitive types together into a cohesive code snippet:
using { /Verse.org/Simulation }

RunTypeDemo() : void =
    PlayerName : string = "Joash"
    Score : int = 10
    Multiplier : float = 1.5
    Bonus := Score / 2        # rational = 5/1
    IsWinner : logic = true
    Letter : char = 'J'
    Emoji : char32 = '\u{1F44D}' # ๐Ÿ‘

    Print("Player: {PlayerName}")
    Print("Score: {Score}")
    Print("Bonus: {Bonus}")
    Print("Winner: {if (IsWinner?) then "Yes" else "No"}")
    Print("Initial: {Letter} {Emoji}")


Popular posts from this blog

How to Check if Someone is Connected to Your Machine in Linux

In today's tech-savvy world, securing your machine is more crucial than ever. Imagine finding out that someone else is accessing your files or using your resources without permission. It’s unnerving, right? If you’re a Linux user, knowing how to check for unauthorized connections can help you safeguard your system. Here’s a straightforward guide on how to spot if someone is connected to your Linux machine. Understanding Network Connections Before jumping into the steps, let's get a grasp of what network connections mean. Every device connected to the internet has an IP address. When another user connects to your machine, they do it through this address. This connection could happen through various means, such as a direct network connection or even over the internet. Recognizing established connections is essential. Think of it like keeping an eye on who enters your home. You want to know who’s coming and going at all times, right? Using the netstat Command One of the most...

How to Set Up a Linux Web Server and Host an HTML Page Easily

Setting up a web server on Linux means spending a fair amount of time in the terminal — Linux leans heavily on the command line rather than clicking through menus, so you'll be typing out instructions more often than not.  If you're new to this, it can feel a little intimidating at first, but the good news is you don't need to become a Linux wizard overnight. A handful of core commands will get you surprisingly far. A few you'll lean on constantly: cd — move between directories ls — see what's in the current directory mkdir — create a new folder nano or vim — edit files right there in the terminal sudo — run something with administrator privileges Get comfortable with these and you'll be able to navigate around, tweak configuration files, and install software without much trouble. You don't need to memorize everything — you just need to be confident enough to follow along with clear instructions, which is exactly what this guide aims to give you....

SQL Server JDBC Driver: A Complete Guide

In this post, you'll find practical examples to get started with SQL Server and Java. From setting up the driver to executing SQL queries, we'll guide you every step of the way.  By the end, you'll know how to make your Java application communicate with SQL Server like a pro. Ready to enhance your database skills? Let's dive in. What is JDBC? Have you ever thought about how software connects to databases? JDBC is your answer. Java Database Connectivity, or JDBC, serves as the handshake between your Java application and databases like SQL Server. It's all about making data talk fluent Java. Overview of JDBC Architecture Think of JDBC as a structural framework with key components holding up a bridge of data exchange. Here's what makes up the JDBC architecture: Driver Manager : This is like the traffic cop directing different database drivers. It ensures the right driver talks to the right database. In simpler terms, it manages the connections and keeps ever...