Hi all. While reading up on Google Docs scripts, I found their introduction to pseudocode. It's a nice "real world" example of it that kids might understand.<br><br><a href="http://code.google.com/googleapps/appsscript/guide_writing_scripts.html">http://code.google.com/googleapps/appsscript/guide_writing_scripts.html</a><br>
<br>In case you can't get to it, it reads in part:<br><br><h2 style="color: rgb(0, 0, 102);">Planning a Script</h2><span style="color: rgb(0, 0, 102);">
</span><p style="color: rgb(0, 0, 102);">When you're planning a script, you'll find it helpful to write <em>pseudocode</em>
first. Pseudocode is a precise and detailed narrative version of what
the script needs to do. You use pseudocode to help you determine how
many functions your script needs, where you need loops and counters,
where you need variables, and where to perform different calculations.
Here's pseudocode for the stock price script.</p><span style="color: rgb(0, 0, 102);">
</span><pre style="color: rgb(0, 0, 102);" class="prettyprint"><span class="pln">first </span><span class="kwd">function</span><span class="pln"> runs </span><span class="kwd">when</span><span class="pln"> </span><span class="typ">Spreadsheet</span><span class="pln"> </span><span class="kwd">is</span><span class="pln"> opened<br>
read the current </span><span class="typ">Spreadsheet</span><span class="pln"> </span><span class="kwd">into</span><span class="pln"> a variable<br>define menu entries<br>define menu name<br><br>second </span><span class="kwd">function</span><span class="pln"> does most of the work </span><span class="kwd">in</span><span class="pln"> the </span><span class="typ">Spreadsheet</span><span class="pln"><br>
read the current </span><span class="typ">Spreadsheet</span><span class="pln"> </span><span class="kwd">into</span><span class="pln"> a variable<br></span><span class="kwd">set</span><span class="pln"> the column labels<br>
define a counter called row<br>start a </span><span class="kwd">while</span><span class="pln"> </span><span class="kwd">true</span><span class="pln"> loop<br></span><span class="kwd">use</span><span class="pln"> an </span><span class="kwd">if</span><span class="pln"> loop to test whether there</span><span class="str">'s a stock symbol in the current row first column<br>
write data to the log<br>look up the stock symbol<br>write the stock information in the correct column of each row that has a stock symbol<br>write data to the log<br>increment the counter</span></pre><span style="color: rgb(0, 0, 102);">
</span><p style="color: rgb(0, 0, 102);">The more detail you put in the pseudocode, the easier it will be to write the script.</p><br clear="all"><br>-- <br>Mark Kelly<br>Manager of ICT, Reporting, IT Learning Area<br>McKinnon Secondary College<br>
McKinnon Rd McKinnon 3204, Victoria, Australia<br>Direct line / Voicemail: +613 8520 9085, Fax +613 9578 9253<br><a href="mailto:kel@mckinnonsc.vic.edu.au" target="_blank">kel@mckinnonsc.vic.edu.au</a><br>VCE IT Lecture Notes: <a href="http://vceit.com" target="_blank">http://vceit.com</a><br>
Moderator: <a href="http://www.edulists.com.au/" target="_blank">IT Applications Edulist</a><br><br><font>Want a good time? Call 0112358. Ask for Mr </font>Fibonacci.<br>