"Yoda condition" meaning in English

See Yoda condition in All languages combined, or Wiktionary

Noun

IPA: /ˌjəʊdə kənˈdɪʃn̩/ [Received-Pronunciation], /ˌjəʊdə kənˈdɪʃən/ [General-American] Audio: En-us-Yoda condition.oga [General-American] Forms: Yoda conditions [plural]
Rhymes: -ɪʃən Etymology: 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. Etymology templates: {{coinage|en|Félix Cloutier|nobycat=1|nocap=1|w=-}} coined by Félix Cloutier, {{m|en|Yoda notation}} Yoda notation, {{nb...}} […] Head templates: {{en-noun}} Yoda condition (plural Yoda conditions)
  1. (programming, informal) A logical condition with the usual order of operands reversed for various reasons, such as avoiding accidental misuse of = (assignment) instead of == (equality), a mistake that is harder to spot when using the normal order of operands. Wikipedia link: Lucasfilm, Stack Overflow, Star Wars, Star Wars: Episode II – Attack of the Clones, Yoda Tags: informal Categories (topical): Programming Related terms: Yoda notation, lvalue, rvalue Translations (logical condition with the usual order of operands reversed): 尤達條件 (Chinese Mandarin), 尤达条件 (Yóudá tiáojiàn) (Chinese Mandarin), ehto, jossa vakio on vasemmalla (Finnish), condition Yoda [feminine] (French), condición Yoda [feminine] (Spanish)

Inflected forms

Download JSON data for Yoda condition meaning in English (7.5kB)

{
  "etymology_templates": [
    {
      "args": {
        "1": "en",
        "2": "Félix Cloutier",
        "nobycat": "1",
        "nocap": "1",
        "w": "-"
      },
      "expansion": "coined by Félix Cloutier",
      "name": "coinage"
    },
    {
      "args": {
        "1": "en",
        "2": "Yoda notation"
      },
      "expansion": "Yoda notation",
      "name": "m"
    },
    {
      "args": {},
      "expansion": "[…]",
      "name": "nb..."
    }
  ],
  "etymology_text": "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.",
  "forms": [
    {
      "form": "Yoda conditions",
      "tags": [
        "plural"
      ]
    }
  ],
  "head_templates": [
    {
      "args": {},
      "expansion": "Yoda condition (plural Yoda conditions)",
      "name": "en-noun"
    }
  ],
  "hyphenation": [
    "Yo‧da"
  ],
  "lang": "English",
  "lang_code": "en",
  "pos": "noun",
  "senses": [
    {
      "categories": [
        {
          "kind": "other",
          "name": "English entries with incorrect language header",
          "parents": [
            "Entries with incorrect language header",
            "Entry maintenance"
          ],
          "source": "w"
        },
        {
          "kind": "other",
          "name": "English entries with language name categories using raw markup",
          "parents": [
            "Entries with language name categories using raw markup",
            "Entry maintenance"
          ],
          "source": "w"
        },
        {
          "kind": "other",
          "name": "English terms with non-redundant non-automated sortkeys",
          "parents": [
            "Terms with non-redundant non-automated sortkeys",
            "Entry maintenance"
          ],
          "source": "w"
        },
        {
          "kind": "other",
          "name": "Undetermined quotations with omitted translation",
          "parents": [
            "Quotations with omitted translation",
            "Entry maintenance"
          ],
          "source": "w"
        },
        {
          "kind": "topical",
          "langcode": "en",
          "name": "Programming",
          "orig": "en:Programming",
          "parents": [
            "Computing",
            "Software engineering",
            "Technology",
            "Computer science",
            "Engineering",
            "Software",
            "All topics",
            "Sciences",
            "Applied sciences",
            "Media",
            "Fundamental",
            "Communication"
          ],
          "source": "w"
        }
      ],
      "examples": [
        {
          "ref": "2013, Adam Onishi, “Getting Started”, in Pro WordPress Theme Development, Berkeley, Calif.: Apress, Springer Nature, page 14",
          "text": "A great convention to stick to, the Yoda condition requires you to keep the comparison variable on the right side of the conditional statement.",
          "type": "quotation"
        },
        {
          "ref": "2014, Kirk Hazen, “The Winding Paths of Language in Education”, in An Introduction to Language (Linguistics in the World), Malden, Mass.: Wiley-Blackwell, page 331",
          "text": "A computer programmer is trying to explain a recent problem to a journalist friend, and she says, \"This jimmy had put in Yoda conditions and had been refactoring my previous work so that in the end it was just hooker code.\" The journalist friend looks baffled.",
          "type": "quotation"
        },
        {
          "ref": "2015, Jim Manico, August Detlefsen, “Access Control”, in Iron-clad Java: Building Secure Web Applications (Oracle Press), New York, N.Y.: McGraw-Hill Education, page 66",
          "text": "// what happens if the debug parameter is removed // from the request and becomes a null? // should really be using a Yoda Condition here ;)",
          "type": "quotation"
        },
        {
          "ref": "2015 February, William Sherif, “If, Else, and Switch”, in Learning C++ by Creating Games with UE4: Learn C++ Programming with a Fun, Real-world Application that Allows You to Create Your Own Games!, Birmingham, West Midlands: Packt Publishing, page 48",
          "text": "Writing if(isHungry = true) by accident will set isHungry to true every time the if statement is hit! To avoid this possibility, we can just write if(isHungry). Alternatively, some (wise) people use what are called Yoda conditions to check an if statement: if(true == isHungry). The reason we write the if statement in this way is that, if we accidentally write if(true = isHungry), this will generate a compiler error, catching the mistake.",
          "type": "quotation"
        },
        {
          "ref": "2020, Amy Noelle Parks, “Evie”, in The Quantum Weirdness of the Almost-kiss, New York, N.Y.: Amulet Books, Abrams Books",
          "text": "Leo grimaces at Caleb. \"I never asked—how did you figure it out?\" / \"Yoda conditions. You may as well have signed your name.\" At my blank look, Caleb says, \"Your boyfriend writes his code backwards.\"",
          "type": "quotation"
        },
        {
          "ref": "2022, Paul Deitel, Harvey Deitel, C++20 for Programmers: An Objects-natural Approach (Deitel Developer Series), Boston, Mass.: Pearson Prentice Hall",
          "text": "Programmers normally write conditions such as x == 7 with the variable name (an lvalue) on the left and the literal (an rvalue) on the right. Placing the literal on the left, as in 7 == x (which is syntactically correct and is sometimes called a \"Yoda condition\"), enables the compiler to issue an error if you accidentally replace the == operator with =. The compiler treats this as a compilation error because you can't change a literal's value.",
          "type": "quotation"
        }
      ],
      "glosses": [
        "A logical condition with the usual order of operands reversed for various reasons, such as avoiding accidental misuse of = (assignment) instead of == (equality), a mistake that is harder to spot when using the normal order of operands."
      ],
      "id": "en-Yoda_condition-en-noun-ELb7zkdV",
      "links": [
        [
          "programming",
          "programming#Noun"
        ],
        [
          "logical",
          "logical"
        ],
        [
          "condition",
          "condition#Noun"
        ],
        [
          "usual",
          "usual#Adjective"
        ],
        [
          "order",
          "order#Noun"
        ],
        [
          "operand",
          "operand"
        ],
        [
          "reversed",
          "reverse#Verb"
        ],
        [
          "reasons",
          "reason#Noun"
        ],
        [
          "avoid",
          "avoid"
        ],
        [
          "accidental",
          "accidental#Adjective"
        ],
        [
          "misuse",
          "misuse#Noun"
        ],
        [
          "assignment",
          "assignment"
        ],
        [
          "equality",
          "equality"
        ],
        [
          "mistake",
          "mistake#Noun"
        ],
        [
          "harder",
          "hard#Adjective"
        ],
        [
          "spot",
          "spot#Verb"
        ],
        [
          "using",
          "use#Verb"
        ],
        [
          "normal",
          "normal#Adjective"
        ]
      ],
      "raw_glosses": [
        "(programming, informal) A logical condition with the usual order of operands reversed for various reasons, such as avoiding accidental misuse of = (assignment) instead of == (equality), a mistake that is harder to spot when using the normal order of operands."
      ],
      "related": [
        {
          "word": "Yoda notation"
        },
        {
          "word": "lvalue"
        },
        {
          "word": "rvalue"
        }
      ],
      "tags": [
        "informal"
      ],
      "topics": [
        "computing",
        "engineering",
        "mathematics",
        "natural-sciences",
        "physical-sciences",
        "programming",
        "sciences"
      ],
      "translations": [
        {
          "code": "cmn",
          "lang": "Chinese Mandarin",
          "sense": "logical condition with the usual order of operands reversed",
          "word": "尤達條件"
        },
        {
          "code": "cmn",
          "lang": "Chinese Mandarin",
          "roman": "Yóudá tiáojiàn",
          "sense": "logical condition with the usual order of operands reversed",
          "word": "尤达条件"
        },
        {
          "code": "fi",
          "lang": "Finnish",
          "sense": "logical condition with the usual order of operands reversed",
          "word": "ehto, jossa vakio on vasemmalla"
        },
        {
          "code": "fr",
          "lang": "French",
          "sense": "logical condition with the usual order of operands reversed",
          "tags": [
            "feminine"
          ],
          "word": "condition Yoda"
        },
        {
          "code": "es",
          "lang": "Spanish",
          "sense": "logical condition with the usual order of operands reversed",
          "tags": [
            "feminine"
          ],
          "word": "condición Yoda"
        }
      ],
      "wikipedia": [
        "Lucasfilm",
        "Stack Overflow",
        "Star Wars",
        "Star Wars: Episode II – Attack of the Clones",
        "Yoda"
      ]
    }
  ],
  "sounds": [
    {
      "ipa": "/ˌjəʊdə kənˈdɪʃn̩/",
      "tags": [
        "Received-Pronunciation"
      ]
    },
    {
      "ipa": "/ˌjəʊdə kənˈdɪʃən/",
      "tags": [
        "General-American"
      ]
    },
    {
      "rhymes": "-ɪʃən"
    },
    {
      "audio": "En-us-Yoda condition.oga",
      "mp3_url": "https://upload.wikimedia.org/wikipedia/commons/transcoded/d/d2/En-us-Yoda_condition.oga/En-us-Yoda_condition.oga.mp3",
      "ogg_url": "https://upload.wikimedia.org/wikipedia/commons/d/d2/En-us-Yoda_condition.oga",
      "tags": [
        "General-American"
      ],
      "text": "Audio (GA)"
    }
  ],
  "word": "Yoda condition"
}
{
  "etymology_templates": [
    {
      "args": {
        "1": "en",
        "2": "Félix Cloutier",
        "nobycat": "1",
        "nocap": "1",
        "w": "-"
      },
      "expansion": "coined by Félix Cloutier",
      "name": "coinage"
    },
    {
      "args": {
        "1": "en",
        "2": "Yoda notation"
      },
      "expansion": "Yoda notation",
      "name": "m"
    },
    {
      "args": {},
      "expansion": "[…]",
      "name": "nb..."
    }
  ],
  "etymology_text": "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.",
  "forms": [
    {
      "form": "Yoda conditions",
      "tags": [
        "plural"
      ]
    }
  ],
  "head_templates": [
    {
      "args": {},
      "expansion": "Yoda condition (plural Yoda conditions)",
      "name": "en-noun"
    }
  ],
  "hyphenation": [
    "Yo‧da"
  ],
  "lang": "English",
  "lang_code": "en",
  "pos": "noun",
  "related": [
    {
      "word": "Yoda notation"
    },
    {
      "word": "lvalue"
    },
    {
      "word": "rvalue"
    }
  ],
  "senses": [
    {
      "categories": [
        "English coinages",
        "English countable nouns",
        "English entries with incorrect language header",
        "English entries with language name categories using raw markup",
        "English eponyms",
        "English informal terms",
        "English lemmas",
        "English multiword terms",
        "English nouns",
        "English terms derived from Star Wars",
        "English terms with IPA pronunciation",
        "English terms with audio links",
        "English terms with non-redundant non-automated sortkeys",
        "English terms with quotations",
        "Rhymes:English/ɪʃən",
        "Rhymes:English/ɪʃən/5 syllables",
        "Undetermined quotations with omitted translation",
        "Undetermined terms with quotations",
        "en:Programming"
      ],
      "examples": [
        {
          "ref": "2013, Adam Onishi, “Getting Started”, in Pro WordPress Theme Development, Berkeley, Calif.: Apress, Springer Nature, page 14",
          "text": "A great convention to stick to, the Yoda condition requires you to keep the comparison variable on the right side of the conditional statement.",
          "type": "quotation"
        },
        {
          "ref": "2014, Kirk Hazen, “The Winding Paths of Language in Education”, in An Introduction to Language (Linguistics in the World), Malden, Mass.: Wiley-Blackwell, page 331",
          "text": "A computer programmer is trying to explain a recent problem to a journalist friend, and she says, \"This jimmy had put in Yoda conditions and had been refactoring my previous work so that in the end it was just hooker code.\" The journalist friend looks baffled.",
          "type": "quotation"
        },
        {
          "ref": "2015, Jim Manico, August Detlefsen, “Access Control”, in Iron-clad Java: Building Secure Web Applications (Oracle Press), New York, N.Y.: McGraw-Hill Education, page 66",
          "text": "// what happens if the debug parameter is removed // from the request and becomes a null? // should really be using a Yoda Condition here ;)",
          "type": "quotation"
        },
        {
          "ref": "2015 February, William Sherif, “If, Else, and Switch”, in Learning C++ by Creating Games with UE4: Learn C++ Programming with a Fun, Real-world Application that Allows You to Create Your Own Games!, Birmingham, West Midlands: Packt Publishing, page 48",
          "text": "Writing if(isHungry = true) by accident will set isHungry to true every time the if statement is hit! To avoid this possibility, we can just write if(isHungry). Alternatively, some (wise) people use what are called Yoda conditions to check an if statement: if(true == isHungry). The reason we write the if statement in this way is that, if we accidentally write if(true = isHungry), this will generate a compiler error, catching the mistake.",
          "type": "quotation"
        },
        {
          "ref": "2020, Amy Noelle Parks, “Evie”, in The Quantum Weirdness of the Almost-kiss, New York, N.Y.: Amulet Books, Abrams Books",
          "text": "Leo grimaces at Caleb. \"I never asked—how did you figure it out?\" / \"Yoda conditions. You may as well have signed your name.\" At my blank look, Caleb says, \"Your boyfriend writes his code backwards.\"",
          "type": "quotation"
        },
        {
          "ref": "2022, Paul Deitel, Harvey Deitel, C++20 for Programmers: An Objects-natural Approach (Deitel Developer Series), Boston, Mass.: Pearson Prentice Hall",
          "text": "Programmers normally write conditions such as x == 7 with the variable name (an lvalue) on the left and the literal (an rvalue) on the right. Placing the literal on the left, as in 7 == x (which is syntactically correct and is sometimes called a \"Yoda condition\"), enables the compiler to issue an error if you accidentally replace the == operator with =. The compiler treats this as a compilation error because you can't change a literal's value.",
          "type": "quotation"
        }
      ],
      "glosses": [
        "A logical condition with the usual order of operands reversed for various reasons, such as avoiding accidental misuse of = (assignment) instead of == (equality), a mistake that is harder to spot when using the normal order of operands."
      ],
      "links": [
        [
          "programming",
          "programming#Noun"
        ],
        [
          "logical",
          "logical"
        ],
        [
          "condition",
          "condition#Noun"
        ],
        [
          "usual",
          "usual#Adjective"
        ],
        [
          "order",
          "order#Noun"
        ],
        [
          "operand",
          "operand"
        ],
        [
          "reversed",
          "reverse#Verb"
        ],
        [
          "reasons",
          "reason#Noun"
        ],
        [
          "avoid",
          "avoid"
        ],
        [
          "accidental",
          "accidental#Adjective"
        ],
        [
          "misuse",
          "misuse#Noun"
        ],
        [
          "assignment",
          "assignment"
        ],
        [
          "equality",
          "equality"
        ],
        [
          "mistake",
          "mistake#Noun"
        ],
        [
          "harder",
          "hard#Adjective"
        ],
        [
          "spot",
          "spot#Verb"
        ],
        [
          "using",
          "use#Verb"
        ],
        [
          "normal",
          "normal#Adjective"
        ]
      ],
      "raw_glosses": [
        "(programming, informal) A logical condition with the usual order of operands reversed for various reasons, such as avoiding accidental misuse of = (assignment) instead of == (equality), a mistake that is harder to spot when using the normal order of operands."
      ],
      "tags": [
        "informal"
      ],
      "topics": [
        "computing",
        "engineering",
        "mathematics",
        "natural-sciences",
        "physical-sciences",
        "programming",
        "sciences"
      ],
      "wikipedia": [
        "Lucasfilm",
        "Stack Overflow",
        "Star Wars",
        "Star Wars: Episode II – Attack of the Clones",
        "Yoda"
      ]
    }
  ],
  "sounds": [
    {
      "ipa": "/ˌjəʊdə kənˈdɪʃn̩/",
      "tags": [
        "Received-Pronunciation"
      ]
    },
    {
      "ipa": "/ˌjəʊdə kənˈdɪʃən/",
      "tags": [
        "General-American"
      ]
    },
    {
      "rhymes": "-ɪʃən"
    },
    {
      "audio": "En-us-Yoda condition.oga",
      "mp3_url": "https://upload.wikimedia.org/wikipedia/commons/transcoded/d/d2/En-us-Yoda_condition.oga/En-us-Yoda_condition.oga.mp3",
      "ogg_url": "https://upload.wikimedia.org/wikipedia/commons/d/d2/En-us-Yoda_condition.oga",
      "tags": [
        "General-American"
      ],
      "text": "Audio (GA)"
    }
  ],
  "translations": [
    {
      "code": "cmn",
      "lang": "Chinese Mandarin",
      "sense": "logical condition with the usual order of operands reversed",
      "word": "尤達條件"
    },
    {
      "code": "cmn",
      "lang": "Chinese Mandarin",
      "roman": "Yóudá tiáojiàn",
      "sense": "logical condition with the usual order of operands reversed",
      "word": "尤达条件"
    },
    {
      "code": "fi",
      "lang": "Finnish",
      "sense": "logical condition with the usual order of operands reversed",
      "word": "ehto, jossa vakio on vasemmalla"
    },
    {
      "code": "fr",
      "lang": "French",
      "sense": "logical condition with the usual order of operands reversed",
      "tags": [
        "feminine"
      ],
      "word": "condition Yoda"
    },
    {
      "code": "es",
      "lang": "Spanish",
      "sense": "logical condition with the usual order of operands reversed",
      "tags": [
        "feminine"
      ],
      "word": "condición Yoda"
    }
  ],
  "word": "Yoda condition"
}

This page is a part of the kaikki.org machine-readable English dictionary. This dictionary is based on structured data extracted on 2024-05-01 from the enwiktionary dump dated 2024-04-21 using wiktextract (f4fd8c9 and c9440ce). The data shown on this site has been post-processed and various details (e.g., extra categories) removed, some information disambiguated, and additional data merged from other sources. See the raw data download page for the unprocessed wiktextract data.

If you use this data in academic research, please cite Tatu Ylonen: Wiktextract: Wiktionary as Machine-Readable Structured Data, Proceedings of the 13th Conference on Language Resources and Evaluation (LREC), pp. 1317-1325, Marseille, 20-25 June 2022. Linking to the relevant page(s) under https://kaikki.org would also be greatly appreciated.