function myFunction() { var x = "This variable contains a string."; var y = 3; var z = 3.14; logVariables(x, y, z); x = x + 1; y = y + 1; z = z + 1; logVariables(x, y, z); logVariables(typeof x,typeof y,typeof z); } function logVariables(x, y, z) { Logger.log(x); Logger.log(y); Logger.log(z); Logger.log(""); }
Note: this program does exactly the same thing as the previous example. The difference is that the code here is much ‘cleaner’, meaning that there is nothing that is redundant or unnecessary.
Google Scripts Lessons 1-10
Click on a lesson below for a written tutorial demonstrating the lesson.
- Lesson 1 – “Hello World!”
- Lesson 2 – Challenge: Calling Functions
- Lesson 3 – Variables
- Lesson 4 – Variable Passing
- Lesson 5 – Variable Passing Challenge
- Lesson 6 – Arrays of Variables
- Lesson 7 – Modifying a Google Doc
- Lesson 8 – Modify Doc and Send Email
- Lesson 9 – Simple Feedback script
- Lesson 10 – Full-scale feedback