1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

terraformでallfalse, anyfalse相当の処理を行う方法

Last updated at Posted at 2025-12-14

terraformには、配列内の全ての要素がtrueであるかチェックする関数 alltrue と、いずれかの要素がtrueであるかをチェックする関数 anytrue があります。

しかし、 allfalseanyfalse という関数は存在しません。どのようにすれば良いでしょうか?
ド・モルガンの法則を考えると、それぞれの否定をとると、 allfalse や anyfalse と同等の処理になることが分かります。

# allfalse(list)相当の処理
!anytrue(list)

# anyfalse(list)相当の処理
!alltrue(list)
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?