| 意味 | 例文 (2件) |
Yoda conditionとは 意味・読み方・使い方
追加できません
(登録数上限)
Wiktionary英語版での「Yoda condition」の意味 |
Yoda condition
出典:『Wiktionary』 (2026/02/20 20:06 UTC 版)
語源
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.
発音
名詞
Yoda condition (plural Yoda conditions)
| Example |
|---|
The condition |
- (programming, informal) 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. [from early 21st c.]-
2013, Adam Onishi, “Getting Started”, in Pro WordPress Theme Development, Berkeley, Calif.: Apress, Springer Nature, →ISBN, page 14:
-
A great convention to stick to, the Yoda condition requires you to keep the comparison variable on the right side of the conditional statement.
-
-
2014, Kirk Hazen, “The Winding Paths of Language in Education”, in An Introduction to Language (Linguistics in the World), Malden, Mass.: Wiley-Blackwell, →ISBN, page 331:
-
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.
-
-
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, →ISBN, page 48:
-
Writing
if(isHungry = true)by accident will setisHungryto true every time theifstatement is hit! To avoid this possibility, we can just writeif(isHungry). Alternatively, some (wise) people use what are called Yoda conditions to check an if statement:if(true == isHungry). The reason we write theifstatement in this way is that, if we accidentally writeif(true = isHungry), this will generate a compiler error, catching the mistake.
-
-
2022, Paul Deitel, Harvey Deitel, C++20 for Programmers: An Objects-natural Approach (Deitel Developer Series), Boston, Mass.: Pearson Prentice Hall, →ISBN:
-
Programmers normally write conditions such as
x == 7with the variable name (an lvalue) on the left and the literal (an rvalue) on the right. Placing the literal on the left, as in7 == 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.
-
-
関連する語
参照
- ^ From Star Wars: Episode II – Attack of the Clones (2002): see “The StarWars.com 10: Best Yoda Quotes”, in Starwars.com, San Francisco, Calif.: Lucasfilm, 26 November 2013, archived from the original on 3 April 2024.
- ^ zneak [pseudonym; Félix Cloutier] (12 March 2010), “Weirdest Occurrence Ever, UIButton @selector Detecting Right Button, Doing Wrong ‘Else_if’?”, in Stack Overflow, archived from the original on 28 August 2023: “We should call that comparison style ‘Yoda Conditions’.”
- ^ Thomas M. Tuerke (17 July 2006), “Terminology”, in Thomas.Tuerke.net, archived from the original on 20 August 2008: “Yoda Notation: the reversal of order, in particular in respect to operands of an equality operation in C and C++, […]”; Thomas M. Tuerke (17 April 2013), “Yoda Notation (aka Yoda Condition)—Origin of the Term”, in Thomas.Tuerke.net, archived from the original on 30 January 2024
Further reading
Yoda conditions on Wikipedia.Wikipedia
「Yoda condition」の部分一致の例文検索結果
該当件数 : 2件
Yoshitaka YODA, adding 'Around the time I started working for Murata, his condition was pretty bad,' evaluated as follows.発音を聞く 例文帳に追加
依田義賢は「私がついた頃の村田さんはだいぶ調子が落ちてた頃で」と断った上で、以下のように評価した。 - Wikipedia日英京都関連文書対訳コーパス
The armies of Hojo and Uesugi confronted each other at Kawanakajima; in fear of being attacked on both sides by Kagekatsu and Ieyasu, the Hojo clan made peace with Uesugi on the condition that four provides in northern Shinano be given to Kagekatsu; Ujinao then returned to Komoro-jo Castle, which he had seized from Nobushige YODA.発音を聞く 例文帳に追加
北条・上杉両軍は川中島で対峙したが、北条は景勝と家康の挟み撃ちになることを恐れ、北信濃4郡を景勝に渡す条件で講和し、氏直は依田信蕃から奪った小諸城に引き上げた。 - Wikipedia日英京都関連文書対訳コーパス
-
履歴機能
過去に調べた
単語を確認! -
語彙力診断
診断回数が
増える! -
マイ単語帳
便利な
学習機能付き! -
マイ例文帳
文章で
単語を理解! -
|
| 意味 | 例文 (2件) |
|
|
Yoda conditionのページの著作権
英和・和英辞典
情報提供元は
参加元一覧
にて確認できます。
|
Text is available under Creative Commons Attribution-ShareAlike (CC-BY-SA) and/or GNU Free Documentation License (GFDL). Weblio英和・和英辞典に掲載されている「Wiktionary英語版」の記事は、WiktionaryのYoda condition (改訂履歴)の記事を複製、再配布したものにあたり、Creative Commons Attribution-ShareAlike (CC-BY-SA)もしくはGNU Free Documentation Licenseというライセンスの下で提供されています。 |
ピン留めアイコンをクリックすると単語とその意味を画面の右側に残しておくことができます。 |
|
ログイン |
Weblio会員(無料)になると
|
-
1eight
-
2meet
-
3false
-
4square brackets
-
5shipping policy
-
6while
-
7translate
-
8theater
-
9improve
-
10feature
「Yoda condition」のお隣キーワード |
weblioのその他のサービス
|
ログイン |
Weblio会員(無料)になると
|