Snowball Docs
SocialsContributeTry out online!Standard Library
  • 👋Welcome to snowball!
  • Overview
    • 🐈Why Snowball
    • ✨Language Features
  • fundamentals
    • 🛠️Getting started
    • 📝Installation
      • ‼️Common install issues
    • 👶Hello world!
  • language reference
    • 🌐Global Scope
    • 🤖Functions
      • 🐣Basic syntax
      • 😵Function Generics
      • ❓External functions
      • 🔧Function Attributes
      • 💢LLVM Functions
      • 🚪Program Entries
    • 🎭Types
      • 🔢Primitive types
      • 🔀Reference types
      • ☝️Pointer types
      • 🔓Mutability
      • ⁉️Type generics
      • 🔖Type aliases
      • 🚯Unknown pointer type (void pointers)
    • 🔄Casting
      • 🔐Mutability casting
      • 🦺Dynamic casting
      • 👨‍🎓Type conversions
    • 🏗️Classes
      • 💼Members
      • 🔒Access qualifiers
      • 🛑Final classes
      • 🍧Abstract classes
    • 🔏Access qualifiers
    • ⚒️Macros
      • ✨Builtin macros
    • 🔫Unsafe snowball
    • 😴Generics
    • 🌳Code Flow
      • ☝️If statements
    • 📦Modules
      • 👉Using Statement
  • snowball cli usage
    • 💻CLI usage and parameters
    • 🧪Testing mode
  • Confy
    • ⚙️Getting Started
    • 🐈Snowball's Schema
  • Reky Package Manager
    • 📦Getting Started
  • coding style
    • 💅The desired standard
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. language reference
  2. Types

Mutability

PreviousPointer typesNextType generics

Last updated 1 year ago

Was this helpful?

In Snowball, you can specify the mutability of variables and data to control whether they can be modified or remain immutable. Mutability is an important aspect of programming languages as it determines the ability to change values.

T     // unmutable by default
mut T // mutable type for 'T'

By distinguishing between immutable and mutable values, Snowball ensures that data is handled appropriately based on the intended use and requirements. Immutable values promote safety and prevent accidental modifications, while mutable values provide flexibility and allow for updates when necessary.

It's important to use mutability judiciously and avoid unnecessary mutations. Immutable values are preferred when possible as they simplify program understanding and reasoning, reduce the chance of bugs, and facilitate code optimizations.

🎭
🔓
🔐Mutability casting