Learn Fi
  • Introduction
  • Overview
    • Contract Definitions
    • Basic Types
    • Complex Types
    • Control Structures
    • Local Variables
    • Functions
    • Type Casting
    • Variable Modifiers
    • Global Constants
    • Examples
Powered by GitBook
On this page

Was this helpful?

  1. Overview

Local Variables

In fi, local variables, or temp variables, can be declared within the root section of a contract entry. These variables are perfect for non-state related variables that you need to use on the fly during the execution of your contract. This is done by declaring the variable and type. This type is static and can't be changed.

let <type|struct> <variable name> = <value>;

Value must evaluate to a compatible type. Once defined, these variables can be access via their name:

<variable name>

PreviousControl StructuresNextFunctions

Last updated 6 years ago

Was this helpful?