-
Notifications
You must be signed in to change notification settings - Fork 2
03. Formatting
It is important to stay consistent with formatting throughout your codebase. This makes the code easier to read and understand for yourself and other developers. Choose a formatting style that works for the project.
As an example of staying consistent, you could choose one of the following spacing formats and use it throughout the codebase:
-
MyVariable : int = 5
-
MyVariable:int = 5
Use four spaces for indentation, never tabs. Code blocks should use indented blocks (spaced) rather than curly brackets (braced):
Except when writing single line expressions like option{a}
, my_class{A := b}
, etc.
Use spaces around operators, unless it makes sense to keep the code compact for its context. Add braces to explicitly define the order of operations.
MyNumber := 4 + (2 * (a + b))
Don’t add spaces at the beginnings and ends of brackets. Multiple expressions inside brackets should be separated by a single space.
Keep identifier and type together; add a space around the assignment =
operator. Add a space around type definitions and constant initialization operators (:=
).
MyVariable:int = 5
MyVariable := 5
my_type := class
Follow the same recommendations for brackets, identifiers, and types spacing for function signatures.
- Use a spaced, multiline form to insert a line break. For example:
- DO NOT use a single line, example:
MyTransform := transform{Translation := vector3{X := 100.0, Y := 200.0, Z := 300.0}, Rotation := rotation{...}}
- Define enums in spaced, multiline form if they need per-enumeration comments or if you need to insert a line break.
enum:
Red, # Desc1
Blue, # Desc2
- Only use brackets for inheriting class definitions. For example:
my_base_type := class:
- Do NOT use this styling:
my_base_type := class():
- Avoid using dot-space ". " notation in place of braces. This makes it visually harder to parse whitespace and is a potential source of confusion.
Use of the Unreal Engine, Unreal Editor for Fortnite and Verse is governed by the terms of the Unreal® Engine End User License Agreement.
A majority of this content was taken from VERSE DOCUMENTATION Such content belongs to EPIC GAMES
Verse icon, UEFN, UEFN icon, Unreal Engine, Unreal Engine logo, Fortnite, & Fortnite icon are property of EPIC GAMES
This github is not maintained or endorsed by EPIC GAMES. It is made for educational purposes only.
This wiki was compiled by Lil Wikipedia