Yoda condition

名词 n.
/ˌjəʊdə kənˈdɪʃn̩/    /ˌjoʊdə kənˈdɪʃən/

英文释义

名词 n.
  1. A logical condition with the usual order of operands reversed for various reasons, such as avoiding the accidental misuse of = (assignment) instead of == (equality), an error that is harder to spot when using the normal order of operands. informal
    — A great convention to stick to, the Yoda condition requires you to keep the comparison variable on the right side of the conditional statement.

词形变化

词源

An allusion to the somewhat grammatically reversed speech style of Yoda, a character in the Star Wars franchise—for example, "Truly wonderful, the mind of a child is." The term was possibly coined by Félix Cloutier (username “zneak”) in 2010, based on Yoda notation which is claimed to have been coined by Thomas M. Tuerke and published online in 2006.
0 次浏览 数据来源: Wiktionary