Editing For 1 You are editing an old version of this page. If you save it, any changes made since this version will be lost. You are editing an old version of this page. If you save it, any changes made since this version will be lost. You are not logged in. The rich text editor does not work with JavaScript switched off. Please either enable it in your browser options, or visit your preferences to switch to the old MediaWiki editor == Syntax == === Counting === *{{codeblock|{{code|keyword|For every}}{{tag|whitespace}}{{tag|type|[number/character]}}{{tag|whitespace}}{{tag|variable|new name}}{{tag|whitespace}}{{code|keyword|from}}{{tag|whitespace}}{{tag|value|[number/character]}}{{tag|whitespace}}{{code|keyword|to}}{{tag|whitespace}}{{tag|value|[number/character]}}{{tag|punctuation}}<BR/>[loop body]<BR/>{{code|keyword|That's what I did.}}}} === Iterating === *{{codeblock|{{code|keyword|For every}}{{tag|whitespace}}{{tag|type}}{{tag|whitespace}}{{tag|variable|new name}}{{tag|whitespace}}{{code|keyword|in}}{{tag|whitespace}}{{tag|value|array}}{{tag|punctuation}}<BR/>[loop body]<BR/>{{code|keyword|That's what I did.}}}} == Examples == === Add all the numbers from 1 to 100 === {{codeblock|{{code|keyword|Did you know that}}{{code|whitespace| }}{{code|variable|Spike}}{{code|whitespace| }}{{code|keyword|likes}}{{code|whitespace| }}{{code|type|the number}}{{code|whitespace| }}{{code|literal|0}}{{code|punctuation|?}}{{code|whitespace|<BR/>}}{{code|keyword|For every}}{{code|whitespace| }}{{code|type|number}}{{code|whitespace| }}{{code|variable|x}}{{code|whitespace| }}{{code|keyword|from}}{{code|whitespace| }}{{code|literal|1}}{{code|whitespace| }}{{code|keyword|to}}{{code|whitespace| }}{{code|literal|100}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|variable|Spike}}{{code|whitespace| }}{{code|keyword|now likes}}{{code|whitespace| }}{{code|variable|Spike}}{{code|whitespace| }}{{code|operator|plus}}{{code|whitespace| }}{{code|variable|x}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|That's what I did}}{{code|punctuation|!}}}} ==== Java Equivalent ==== {{codeblock|<SOURCE LANG=java>double Spike = 0; for(double x = 1; x < 100; x++){;; Spike = Spike + x; }</SOURCE>}} === Iterate through an array === {{codeblock|{{code|keyword|Did you know that}}{{code|whitespace| }}{{code|variable|Berry Punch}}{{code|whitespace| }}{{code|keyword|likes}}{{code|whitespace| }}{{code|type|the phrase}}{{code|whitespace| }}{{code|literal|“Cheerwine”}}{{code|punctuation|?}}{{code|whitespace|<BR/>}}{{code|keyword|For every}}{{code|whitespace| }}{{code|type|character}}{{code|whitespace| }}{{code|variable|c}}{{code|whitespace| }}{{code|keyword|in}}{{code|whitespace| }}{{code|variable|Berry Punch}}{{code|whitespace| }}{{code|punctuation|.}}{{code|punctuation|.}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|I said}}{{code|whitespace| }}{{code|variable|c}}{{code|punctuation|.}}{{code|whitespace|<BR/>}}{{code|keyword|That's what I did}}{{code|punctuation|!}}}} ==== Java Equivalent ==== {{codeblock|<SOURCE LANG=java>char[] BerryPunch = new char[]{'C','h','e','e','r','w','i','n','e'}; for(char c : BerryPunch){;; System.out.println(c); }</SOURCE>}} {{Navbox/Phrases}} {{stub}} Loading editor Below are some commonly used wiki markup codes. Simply click on what you want to use and it will appear in the edit box above. Insert: – — … ° ≈ ≠ ≤ ≥ ± − × ÷ ← → · § Sign your username: ~~~~ Wiki markup: {{}} | [] [[]] [[Category:]] #REDIRECT [[]] <s></s> <sup></sup> <sub></sub> <code></code> <blockquote></blockquote> <ref></ref> {{Reflist}} <references/> <includeonly></includeonly> <noinclude></noinclude> {{DEFAULTSORT:}} <nowiki></nowiki> <!-- --> <span class="plainlinks"></span> Symbols: ~ | ¡ ¿ † ‡ ↔ ↑ ↓ • ¶ # ¹ ² ³ ½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ∞ ‘ “ ’ ” «» ¤ ₳ ฿ ₵ ¢ ₡ ₢ $ ₫ ₯ € ₠ ₣ ƒ ₴ ₭ ₤ ℳ ₥ ₦ № ₧ ₰ £ ៛ ₨ ₪ ৳ ₮ ₩ ¥ ♠ ♣ ♥ ♦ View this template This field is a spam trap. DO NOT fill it in! Edit summary Preview Mobile Desktop Show changes