Local vs global scope

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JulioYagami

It’s possible to do the code below?

extends Node

var a = 5

func _ready():
    print(a) # 5
    function_a() # 10

func function_a():
    var a = 10
    print(a)
:bust_in_silhouette: Reply From: Dlean Jeans

Yes. That’s how it works.