What does "in" keyword do in the context of sprite.frame?

Godot Version

v4.2.1.stable.official [b09f793f5]

Question

Recently I saw this code in an old post (check frametime of the current animation in animationplayer - #3 by system):
if anim_player.current_animation == "fire" and sprite.frame in [4, 5]

What does sprite.frame in [4, 5] part do? From the context I assume it checks whether sprite’s frame switched from frame 4 to frame 5, but I have never seen this syntax and it’s impossible to search for how “in” is used together with sprite.frame.

I was also able to find it used on GitHub in a project here: (project), but sadly without any comments.

I tried it on an AnimatedSprite2D and it seems this is how I can get the last two played frames which is fantastic, but I don’t see anything like that mentioned in Help or anywhere else and I don’t understand where is the […] part coming from (I assume it’s a Vector2i, but how would I know AnimatedSprite2D has this accessible without seeing it in this context?).

sprite.frame in [4, 5] is equivalent to sprite.frame == 4 or sprite.frame == 5.

Thanks, I see! :+1: