🔩
Mod Developer
DeveloperModder
  • 👋Welcome!
  • Support
    • Dashboard
    • 📄Dictionary
    • 📘Glossary
      • ▫️Files
        • ▫️Assets
          • ▫️Appendix
        • ▫️Red4 Shaders
          • ▫️Definitions
          • ▫️Descriptions
      • ▫️In-Game Objects
        • ▫️Building
        • ▫️Character
          • ▫️Hair
        • ▫️Clothes
          • ▫️Variants
        • ▫️Environment
        • ▫️Vehicle
          • ▫️Assests
            • ▫️Appearance Mapping
          • ▫️TweakDB
        • ▫️Weapon
    • 🐣Getting Started
      • ▫️1. Setup
      • ▫️2. Download
      • ▫️3. Configure
    • 👪Community Links
    • 🔨Troubleshooting
      • ❔FAQ
      • ❗Problems
  • Documentation
    • Dashboard
    • Generalized guidees
      • Replace a player item with an NPC item
      • Mesh editing
      • Remove an Animation (and Potentially Replace It)
      • Change Position and Rotation of an entMeshComponent
      • PagEdit Voiceover and Subtitles In a Quest
      • Recoloring items
      • Creating new items (adding to the game)
    • 🎨Graphical Editors
      • 🦮General Guides
      • 📄General References
      • ▫️Adobe Substance
      • ▫️Autodesk Maya
      • ▫️Blender
      • ▫️Gimp
      • ▫️Krita
      • ▫️Photoshop
    • 🧑‍💻Modding Tools
      • ▫️Cyberpunk Engine Tweaks
        • 🦮Guides
          • ▫️Installing
            • ▫️Troubleshooting
            • ▫️Proton
          • ▫️Usage
          • ▫️Scripts
          • VS Code
        • 📄Reference Sheets
          • ▫️Config File
          • ▫️Font & font size
          • ▫️Uninstalling
          • ▫️UI Examples
      • ▫️MLSETUP Builder
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️REDmod
        • 🦮Guides
        • 📄Reference Sheets
          • ▫️Commands
            • ▫️Deploy
            • ▫️Import
          • ▫️Usage
          • ▫️Structure
      • ▫️Redscript
        • 🦮Guides
          • Get Started
            • Download
            • REDscript in 2 minutes
        • 📄Reference Sheets
          • Language Features
            • Intrinsics
            • String formatting
            • Loops
      • ▫️Red4ext
        • 🦮Guides
          • ▫️Get Started
            • Installing RED4ext
            • Installing a Plugin
            • Configuration
            • Uninstalling
          • ▫️Creating a Plugin
          • ▫️Creating a Custom Native Class
            • Adding a Native Function
        • 📄Reference Sheets
      • ▫️TweakDB
        • ▫️TweakXL
          • 📄Reference Sheets
        • ▫️ArchiveXL
          • 📄Reference Sheets
        • 🦮Guides
      • ▫️WolvenKit
        • 🦮Guides
          • ▫️Getting Started
            • ▫️Download
            • ▫️Setup
            • ▫️Install
            • ▫️Uninstall
            • ▫️Create a mod
          • ▫️Custom Photo Mode Expressions
        • 📄Reference Sheets
          • ▫️Overview
          • ▫️Editor
            • ▫️Project Explorer
            • ▫️Properties
            • ▫️Asset Browser
          • ▫️Release Notes
      • ▫️WolvenKit.CLI
        • 🦮Guides
        • 📄Reference Sheets
    • ⚙️Utilities
      • ▫️010 Editor
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️3DS
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️Deep Asset Discovery
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️Noesis
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️Notepad++
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️PixelRick's Save Editor
        • 🦮Guides
        • 📄Reference Sheets
  • Collaboration
    • Dashboard
    • 🤝Get Involved
      • Needed Documentation
      • Wanted Ads
    • 📅Meetings
Powered by GitBook
On this page
  • while
  • for..in
  1. Documentation
  2. Modding Tools
  3. Redscript
  4. Reference Sheets
  5. Language Features

Loops

REDscript supports two kinds of loops: while and for..in loops.

while

The while statement works the same way it does in most languages. It allows you to execute a block of code multiple times based on a conditional expression.

let i = 0;
let array = ["a", "b", "c"];

while i < ArraySize(array) {
  let elem = array[i];
  Log(elem);
  i += 1;
}
// will log a, b and c

for..in

The for..in loop allows you to iterate over all elements of an array.

let array = ["a", "b", "c"];

for elem in array {
  Log(elem);
}
// will log a, b and c
PreviousString formattingNextRed4ext

Last updated 2 years ago

🧑‍💻
▫️
📄