AutoIt+
  • Overview
  • Getting started
  • The language
    • Basic
    • Grammar
      • Expressions
      • Statements
      • Declarations
    • Operators
    • Variables
    • Types & values
      • Null
      • Booleans
      • Numbers
      • Strings
      • Functions
      • Classes
      • Pointers
    • Control flow
      • If statement
      • For loop
      • While loop
      • Break & continue
      • Error handling
    • Collections
      • Array
        • APIs
        • Implementation
      • Map
        • APIs
        • Implementation
    • Modules
    • Exceptions
  • Built-in modules
    • C
      • APIs
      • Constants
    • Math
      • APIs
      • Constants
    • Task
      • Types
      • APIs
    • Global
  • The aup
    • Compiler
    • Runtime
    • Options
Powered by GitBook
On this page
  • Declaration
  • Everything is local

Was this helpful?

  1. The language

Variables

PreviousOperatorsNextTypes & values

Last updated 3 years ago

Was this helpful?

Declaration

To declare a variable, we have a var keyword.

// var <name> [= <value>]
var myVar
var a = 10
var b = 50.2
var hello = 'hello'
var alive = true

There are no let or const, so every variable is mutable, except the statement.

Everything is local

To make variables be more explicit, undefined variables lead to syntax error. You must declare your variables before use them.

a = 10    // Syntax error: undefined variable
puts b    // ...

There are no global variables, see module to store data globally.

Global
use