Match Statements and is_in_group()

Is there a way to run body.is_in_group() in a match statement instead of a long list of if/elif/else statements?

You can use get_groups to get an array of the groups the node is in and check them one by one in a match statement. Something like:

	for group in get_groups():
		match group:
			"Group1":
				pass
			"Group2":
				pass
2 Likes

that works pretty good, thank you!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.