Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

for(int i = 4, i < size, i += 2) {

}

What is alternative of this in gdscript. I know basic of for loop it is something like this

for i in range(size):

    pass

here it will start from 0 and run till size - 1 but i want to start for i > 0 and increment 2 each time. How to do that

Deleted post

The range() function accepts three arguments: start, stop and step.

Example that counts 4, 8, 10:

func _ready():
    for i in range(4, 10, 2):
        print(i)

Open example in GDScript Playground