Scripting to add_buff to each actor that has learned a specific skill?

Bit of an obscure request, but help is appreciated!

$game_party.members.any? { |actor| actor.skills.include?($data_skills[1564]) }Can check if any actor has learned a certain skill.

$game_actors[1].add_buff(1, 2)Will buff actor 1 with 1 stack of an MP buff for 2 turns. (MP with default param_id: 1, anyway)

($game_party.members.each? { |actor| actor.skills.include?($data_skills[1564]) }).add_buff(1,2)How do I do something like this, and add a buff to each actor that has learned a specific skill? Can you combine script calls in such a way?

Sorry for the noobiness of this question, haha, and thank you for any help!
$game_party.members.each do |actor|

  if actor.skills.include?($data_skills[1564]) then actor.add_buff(1, 2) end

end

I'm not familiar enough with programming to say with certainty, but it can't be far off. 😳

Unable to test at the moment.
$game_party.members.each do |actor|

  if actor.skills.include?($data_skills[1564]) then actor.add_buff(1, 2) end

end

I'm not familiar enough with programming to say with certainty, but it can't be far off. 😳

Unable to test at the moment.
This seems to work based on my testing! Which is awesome, because this can be applied to much less obscure situations than the one here too, haha, like checking states on actors to do something.

Thank you greatly for the help!

Original thread: https://forums.rpgmakerweb.com/threads/scripting-to-add_buff-to-each-actor-that-has-learned-a-specific-skill.49195/