Home About Prepare Take Part Information Challenge Site Contact

The TCS OCC Tutorials

Blockly Coding Tasks

This type of task is very flexible: Task authors can set problems where a variety of solutions can be given credit for producing the correct answer. These tasks use Function blocks and take this form:

Function Example

How to answer Blockly Coding tasks in the TCS OCC Challenges:
Write all of your code in the function. There is no need to write any code outside of the function. The task author will have provided the necessary parameters and some suitable test data to pass to the function. The Execute block passes these values to the function block as it calls it. (It is OK to change these values to provide yourself with new tests.)

Try writing this code into the function in the workspace below.

simple code

This function now adds the values in the variables b and c, adds them and returns the sum. Run the program to see how this works.

Next >>

Coding tasks - Intro
Recommended practice
Functions, Procedures and Subroutines

Example 1
Example 2
Example 3
Example 4

Tutorials index