Introduction Welcome Getting Started My First Program     Troubleshooting and Distributing Transforming Data Interactive Programs     Programming Exercises     Making Games
Documentation Declarations     Procedures     Variables Statements     Flow Control Expressions Libraries     Print     IO     Random     Game Engine
Tutorials Complete Tutorials     Introduction to Programming     Quick Start     Programming Exercises     Programming Games


These series of tutorials are a complete course on programming!

About the Tutorials

The Introduction to Programming tutorials are a series of tutorials meant to take you from no programming knowledge to a proficient programmer - solving problems and using all the tools at your disposal to expressively code computer software!
These tutorials are inside of Vizzcode, which you can download here.

The course is divided in 9 complete tutorials, each one full of programming resources to be learn:

The first part of the Introduction to Programming Series will introduce you to the incredible world of programming. You will learn important concepts as well as develop your first computer program!

After that, in part 2 you will learn about making your programs interactive by reading data from the user. You will also know about storing data in the computer using variables.

The tutorial part 3 will teach you how to operate data (with the arithmetic operators) as well as the other variable types you have at your disposal.

In part 4 you will learn about the other two operator types in Vizzcode: comparison (or relational) operators and boolean (or logic) operators. Everything you learned will then be applied by learning about if statements, one of the the most important tools in a programmer's belt.

Then, in part 5, you will add loops in your programming belt with the powerful while statement.
Part 6 will build on the previous tutorial's features and introduce you to the break and the continue statements. They will give you more control on the execution flow of loops.

The part 7 of the tutorial series will teach about For loops. They are an easy way to quickly repeat commands or iterate through parts of the code. Essential for more complex programs.

In part 8 you will read, store and operate on several pieces of data of the same kind. To easily achieve this, you will learn about the array data structure.

In the last tutorial (part 9) you will learn about procedures. There are a fundamental tool for organizing bigger programs and reutilizing code.

When you go through all the tutorials in this course, you will develop strong problem-solving and logic-thinking skills. Those skills are extremely important, even if you are not interested in becoming a professional software developer.

The entire course (all 9 tutorials) is available right inside Vizzcode, in the Welcome Screen. You can choose the Introduction to Programming - Part 1 tutorial from there and create a project to follow it.

The following sections of this page were created as a help companion to each tutorial. If you are having a hard time with the tutorial, this page can direct you to where you can learn all about what is being discussed in the tutorials. These help pages are also accessible from inside Vizzcode, in the tutorial header.

Introduction To Programming: Part 1

This tutorial is your entry point to the to the programming world. A world that is different than any other, one where you’ll be able to give life to your imagination. Programming enables you to create games, websites, apps, robots, artificial intelligence, and even create something that no one ever thought!
If you have never programmed before, or want to start in Vizzcode with solid fundamentals, this tutorial is for you! You will learn important concepts and code your first program.

A Whole New World
To follow this tutorial, all you need to do is download Vizzcode and select it in the Welcome Screen.
The Getting Started page will help you set everything up (it's really easy!).

Your First Line Of Code
This page teaches you the very first steps you need to take to start coding your programs.
If you need a more detailed explanation of each step, you can follow the My First Program documentation page. It will introduce you to Computer Science and help you create your first program in a different way, if you are having trouble following the embedded tutorial.
Don't worry too much if you don't some things for now: practice makes perfect and you will have multiple other changes to create your programs.
Specific information can be found in the documentation on the entry point of your program as well as compiling your code.

Hello, Vizzcoder!
Libraries are very important to help you get right to the meat of your program. It's super easy to use libraries in Vizzcode: you can learn all about that here.
The Print Library in particular is great because it allows us to display messages and communicate with the user. Here is how you can use it.
A common problem you might have creating the Hello, Vizzcode program is forgetting to add the message between "double quotes".
Pay attention to the steps described in the tutorial (as well as in the My First Program guide) and make sure your code looks like the tutorial's! Soon enough you will be creating programs with no help at all.

Now It's Up to You
With this simple command you learned, you can instruct the computer to create several nice programs.
You can add several print calls one after another in the program, like so:

How to call several prints in Vizzcode

You can also add more text to a single print:

Printing lots of text in Vizzcode

If you need to break the line (to make sure the text is displayed nicely to the user) you can simplily type \n whenever you want the line to break, like so:

How to print in two different lines

Now that you know the basics, you can head on to the Programming Exercises and practice what you learned. They will be great for you, even at the beginning level. These exercises are an essential tool to your learning.
Afterwards, when you want to learn new things, you can head on to part 2.

Introduction To Programming: Part 2

Now that you finished the first part of the series, created your first program and hopefully practiced that knowledge, you are ready to learn new commands!
In this tutorial, you will learn how to make the user interact with your program!
So jump right inside Vizzcode to follow it!

What does the User have to Say
In the first page you are introduced to several concepts you will learn throughout this tutorial, such as the scan command.
It's very important to understand how data is stored in the computer and how you can access it using variables.
There is a very detailed explanation here, where you can learn all about that. You can read it multiple times if you need to. With that knowledge, move on to the practical part!

Data Input And Output
This tutorial will use the IO library (instead of the Print). It contains everything we need to read data from the user (the scan functionality). You can read everything about the IO library here.

Just like last time you should create an entry point so the computer knows where to start executing commands.
Then, declare a variable. Declaring variables reserves a place in memory we can store and operate on values. You can learn more about declaring variables in this link. It explains in more detail the steps taken in the tutorial.
If you want complete information on variables (and how they work inside Vizzocode), you can access this link. There is also an entire page on declarations here.

What's your Name?
You already know how to print messages to the screen, so now the challenge is assigning a value to a variable. And it's not any value, it's what the scan node read from the user.
Assignments are an important part of programming. By assigning a value, you set the value a variable holds to a specific value. For example, this sets the variable number to the value 5:

How to set values to variables in Vizzcode

You can see more examples of assignments here, as well as the complete information on them here.
Using the scan node is as simple as connecting the bottom connection of the Set assignment node to the value connection of scan. This makes sure that whatever the user writes will be assigned to the variable, setting its memory value accordingly.
A complete breakdown of the IO library with its scan procedures can be found here.

Printing a Variable
Variables contain data just like typing explicit (or literal) numbers on text, directly in the code. Because of this, you can pass the value of variables where otherwise you would type text.
To print the value of a variable, you need draw a connection from the message pin from the print node and select your variable, creating a node that contains its value:

How to use the value of a variable in Vizzcode

You can also press Alt and click on the connection pin to delete the connection.

How to undo or delete a connection in Vizzcode

Note that the type of the variable must match the expected type. That's why connecting a number to the print's message input doesn't work or connecting a text value to a print_int call doesn't work either.
There is a section on the documentation about Printing Variables as well. You can read it here.

Reading and Printing Numbers
The data you ask the computer to store can be of different types. For example, a whole number is one type of data. Text is another.
In Vizzcode, every variable has a type of data it stores. It's very useful because the operations we can perform on the data is checked (and limited) based on its type. For example, you can divide one number by another, but you can't divide a text by another text! Custom operations (like printing, scanning or anything you program) also has this benefit of type-checking.
So in order to read and write variables of type int (whole numbers), you must use procedures that were specifically created to deal with that type (scan_int and print_int).

You can see several examples of reading integer (and text) values here.
There is a section on the documentation about types. You can read all about it here.

Now is your Time
Just like the first tutorial, what you learned in this tutorial can be used to create endless programs.
It's paramount that you put this knowledge to work by improving the program you created in this tutorial. Ask more information about the user and display that to the screen. You can also do a few more Programming Exercises with what you learned.
Once you are confident using scan, scan_int, print and print_int to read and write data inside variables, move on to the next tutorial!

Introduction To Programming: Part 3

This tutorial will open up your programming horizons by showing you how to do arithmetic operations on data.
With this knowledge, you will be able to create several programs that solve real problems!
You will also learn about the other types of data in Vizzcode.
Without further ado, open up Vizzcode and fire up the tutorial!

The Power of an Arithmetic Operation
This tutorial page is just a tease and some examples of why you are going to use arithmetic operations inside your programs.
If you are itching to know more about them, you can go to the Arithmetic Expressions documentation page and learn all about them. :)

Operating on values is one of the most important elements in computer programming.
It works just as expected: you can command the computer to add two numbers (either numbers you typed yourself in the code, or numbers stored in variables).
You can learn a lot more about operating on data by reading this documentation section.

Another great way to learn is by experimenting! You can play around with the nodes you have at your disposal, fixing the errors you encounter and printing the result.

Float Numbers
This section introduces a new type of variable, the float. You can access its documentation page for more info on that.
The main point to take away now is that ints are whole numbers, while float also contain non-integer (decimal) numbers.
You are also introduced to more assignment nodes. They operate on the number before assigning it. For example, the following code will set the value of the variable number to 10: because it will add 2 to its current value and then assign the result to it:

How does the Add and Assign += node works

You can read about all the types of assignment nodes here. You can also experiment with them and print the result to learn by doing! :)

The Boolean Type
Bools (or boolean) are very useful when coding. There are an entire set of operations (the comparison expressions) that compares two values of the same type. For example, given a and b as integer variables, is a equal to b?
As you can imagine, it's very useful to be able to compare data when programming. These comparisons (also called relations or relational operators) only have two possible results, either true or false.
The bool type is a data type that stores either true or false, precisely for cases like this.

To declare a bool variable, you can just change the type in the variable declaration node, like so:

How to declare a bool variable in Vizzcode

Just like any other variable, you can assign new values to it:

Assigning true and false values in Vizzcode

Including values from other variables:

Assigning boolean variables in Vizzcode

The best thing you can do now for your learning journey is head over to the Programming Exercises and flex your problem-solving muscles. The exercises will start off very simple, using basic concepts and it will incrementally get harder to apply what you have been learning in real-world programs!
Even if you are a bit overwhelmed, the best thing you can go is hit the programming gym! :)

PS: Did you find out what the modulo operator does? If not, you can learn all about it here. If you are wondering how you can use it in real programs, there are some very cool exercises for you! ;)

Introduction To Programming: Part 4

In this tutorial, you will learn about one of the most useful programming features: the if statement.
It allows the programmer to control the flow of the program, and change what instructions will be executed based on some value.
You are in for a ride in this tutorial! So start Vizzcode and select the tutorial there to get started!!

IF It Rains, I'll Stay Home Watching Movies
Before jumping into the code, just think about some of your routines and how you might choose to do some things based on conditions.
For example, if you are late, you will drive your car to the airport; if you are not, you will go by foot. Note that if you are late is actually a comparison: it compares the time right now to the time you need to leave your house. This comparison can either be true or false.
Another example: If it's raining, I'll stay home and watch a movie. In this case, the condition is already a boolean value: true or false.

Relational operators (also referred to as conditional or comparison expressions) compare two values of the same type, resulting in a bool value: either true or false. You can learn about all the possible comparison expressions here in the documentation. The exercises also have great information in the hints section.

Don't be afraid to try new things in Vizzcode. Experimenting an idea you have is a great way to learn. If you encounter a programming error in your free experimentations, you can easily fix it.
The challenge's answer will be revealed in the next page, where we will combine different conditions with logic operators. ;)

I'll only go to the Movies If I Finish my Homework and It Stops Raining
In this page you are introduced to the AND logic operator.
The AND combines two booleans and results true only if both of them are true.
Here are all the possible outcomes of the AND expression:




You can learn all about the logic operators (or boolean expressions) here.

This OR That?
The OR is the second logic operator.
It's similar to the AND as it combines two booleans into bool result.
The OR expression will result true if any of its operands are true.
Here are all the possible outcomes of the OR expression:




You can learn all about the logic operators (or boolean expressions) here.

IF "true" do "x"
The if statement is a way to execute certain nodes only if a condition is true.
The condition is a boolean value, true or false. And like we have seen before, conditional expressions (or relational expressions) result in a bool value.
So it's perfect to test a certain relation between values (like age >= 18) and use that condition to execute certain parts of the code (in an if statement).

To add an if statement just create an if node in the code:

How to use an if statement in Vizzcode

You can see how it works by creating a simple program and analyzing the result:

How does the if statement work in Vizzcode

Another one:

An example of using if to branch code conditionally

You can learn all about if statements here.
This page also explains some more details on expressions, which you can read about here.

Now It's Up to You
It's very important to practice this newly acquired knowledge! We have carefully prepared several exercises for you. They present interesting real-world problems.
Once you are confident with if statements, you can go ahead and learn new skills in the next tutorial.

Introduction To Programming: Part 5

Now that you have used if statements in several different programs, you are ready for the next challenge: while loops.
This tutorial will teach you what it is and how to use it!
Just open Vizzcode and get started with the tutorial there.

While That...
The while loop is a way of repeating a certain part of code while a condition is true.
In the "while I'm hungry, I'll eat a cookie" example, you can think about the logic in this other way:

Am I hungry now? Yes. Then eat a cookie.
Am I hungry now? Yes. Then eat a cookie.
Am I hungry now? Yes. Then eat a cookie.
Am I hungry now? No. Then move on.

If you are still trying to wrap your head around the logic, don't worry too much about it, move on to the next section where we will start programming with while loops. Then, you will able to visualize what the program is doing!

I Want a Cookie!
While loops will test a condition then execute the loop body if its true. Then, it will test the condition again. If the condition is true it will run the loop body. Then, it will test the condition again. If the condition is true..... Until the condition is false!

A very simple example to see it working is create a loop that will run forever (using a condition that is always true). Like this:

Using a while loop in Vizzcode

While the condition is true (the true value will be true!), the program will print a message.

Now that you visualized how while loops work a bit better, we can change the condition to be an expression. For example, the variable count will start off equal to 1 then for every iteration of the loop it will increment by one. The while loop condition will be: while count is less then or equal to 3. What do you think will happen?
Here is the program:

An example of the while loop in Vizzcode

Did it execute as you expected?
It's very useful to "execute" the program by hand. This means getting a piece of paper and going line by line on the program, writing down the value of each variable as well as the conditions, like this:
: the program entry point
declare variable count (count is equal to 1)

Is count <= 3? (1 <= 3?) Yes
  Increase count by 1 (count is equal to 2)

Is count <= 3? (2 <= 3?) Yes
  Increase count by 1 (count is equal to 3)

Is count <= 3? (3 <= 3?) Yes
  Increase count by 1 (count is equal to 4)

Is count <= 3? (4 <= 3?) No
This will help you understand how the computer is behaving when running the program.
Try creating a few more simple examples using the while loop, "executing the program by hand" and seeing if the result you expect is actually what the computer is running.

Registering Several People
This page introduces another example using while loops. In this example, the core of the program will keep executing while the value the user types is equal to "yes".
It's important to move one step at a time and execute the program every time.
You can review important concepts such as boolean operations and then re-read the previous pages.

Another great strategy we discussed in the previous page is to execute the program "manually" to make sure you understand what the program is doing in every point and why. Try doing this exercise with this page's program to understand it better.

Another Way to Register
With the tools we discussed in the previous page, you can tackle the challenge of understanding the proposed program better.
There is also a tease of the next tutorial, where you will learn more ways to control the flow of the loop.
The Programming Exercises covering Loops are a great way to strengthen your understanding, especially because the exercises always start easy and incrementally get harder, to make sure your current skills are pushed to the limit!

Introduction To Programming: Part 6

There are ways to have more control over theflow of loop.
The Break and Continue statements are a great way to change this flow.
In this tutorial, you will see how you can simplify the loop condition by using these statements to control the loop.
All you need to do to get started is open Vizzcode and select the tutorial there!

If This Happens... BREAK!
It's very easy to understand break statements: whenever they are hit, the loops immediately exists, no matter the condition.
This page in the tutorial just sets up an infinite loop (like we have seen here) for us to add the break in the next page!

A New Dice Game
The simplest way to see the break in action is in our infinite loop example:

An infinite loop in Vizzcode

If we add a break after the print, how many times you will the program print the message?

Breaking out of a loop

Only one! When the program finds the break statement, the program exists the loop immediately. What about adding the break before the print?

Breaking out of the loop before the print

Now the program exits the loop immediately; before executing the print.
Breaks can be combined with the if statements you learned earlier to create more powerful conditions, like the one in the tutorial page. You can also see this simpler example:

Using an if and a break to control the flow of a loop

Continue Without Executing
The Continue is a statement that will skip this iteration of the loop body. Whenever the program hits a continue statement, it will exit the loop body, but instead of exiting the loop completely (like with the break statement), it will simply move on to the next iteration of the loop.
See the following example. What values will it print?

What does the continue do in Vizzcode

Try adding the code to your program and execute it. Did it print as you expected?
If the if statement is true (count is equal to 4), the program will continue, skipping this execution of the loop body. This means the print_int will not run, but the loop will move to its next iteration.

Introduction To Programming: Part 7

There is another great way to loop over your program: using for loops.
That will be the topic of this tutorial, so just start Vizzcode, select this tutorial and learn a new skill!

For Each
For is just that: executing a certain body of code a number of times!
It starts from the first specified value (including it) and end in the last specified value (also including it).
The iterator variable (the value that goes from the first to the last value) is accessible from the for. It is just a normal counter (or control variable) that increments by 1 in every iteration of the loop.
If you are still having trouble visualizing it, you can check out the for loops in the documentation here or simply move on to the next page where we will implement one inside Vizzcode.

The "for" in Practice
As you can see, adding a for loop is super easy in Vizzcode.
Just drag off a white execution pin and create a for node:

Creating a for loop in Vizzcode

In the Loop Body pin you can add the code what will be repeated.
Then, you can configure the first and last value of the iterator variable. The for loop will execute in that range:

An example program with a for loop in Vizzcode

Here is the same code created using a while node:

The equivalent of a for loop with a while loop

Which is the Biggest Number?
This example uses pretty much every tool you have learned so far.
If you need, you can re-read the specific tutorials on If Statements, loops and break and continue.
You can also access their pages in the documentation: if, while and break and continue.
Another very important tactic you can apply is breaking the problem down or manually executing the program so you can understand it better.

Before going to the next tutorial page, take some time to finish all Programming Exercises on Loops, now that you have all the tools at your disposal! They will make sure your knowledge is solid before adding new elements to your programmer toolkit!

Introduction To Programming: Part 8

In this tutorial, you will learn a very important data structure to organize your data: arrays! When you have lots of data of the same type, you can use an array to easily store and operate on all of it.
Let's learn how to use them in your programs! Start Vizzcode, open this tutorial and let's go!

A Locker with Several Sectors
Arrays is a great way to structure your data when you have several values of the same type that relate to each other.
For example, if you must read several numbers from the user then operate on them in several ways, an array is perfect for that.
You create an array by inserting a New Variable node, choosing its data type, clicking the array button, then typing a size for the array:

Creating an array in Vizzcode

In the image, the array stores 5 different ints.
You can access and operate on the individually or easily iterate through the entire array.
We will play around with arrays in the rest of the tutorial, then I will direct you to the exercises where you will be challenged real world (and very cool) problems!

As a companion to this tutorial, you can also follow the arrays documentation page here.

Initializing the Array
This page introduces you the two most fundamental ways to use arrays: accessing its elements individually, and iterating through the array.
In both these cases, you can use the array subscript operator. There is an entire section on array subscripts here.
By subscripting the array with an index, you access the array on that position and you can use it just like a normal variable you are used to: assigning values to it or operating on them normally.
The interesting thing about using arrays is that by using a for loop that covers the range of the array you can write a piece of code once and have it work on several values! The range of an array starts with its first index (zero) and goes all the way to its last index (in the case of an array of size 10, the last index will be 9). This is because arrays' indexes are zero-based. For example: in an array of size 4, the valid indexes are 0, 1, 2 and 3.
A for loop that moves the iterator variable through the entire range, can subscript the array at the position of the iterator. This way it will execute the loop body for every element (the first time the loop will operate on the array at index 0, the second time, at index 1 and so on...)

If you want to consolidate what you learned so far in this tutorial before moving on, you can solve the first few Programming Exercises on arrays.

Registering Several People
This page expands on the idea of using arrays to store data and create two arrays in parallel, to store the names and ages of the players.
Each person will be associated with an index and you can access that person's data by indexing each array at that position.
For example: the first person's name is stored in the names array at the position 0, and that person's age is stored in the ages array at the position 0 as well. The second person will use the index 1 of both arrays, the third will use the index 2 and so on.

This is the complete program:

:: () {
    names: [
    ages : [
        names[it] =
"\Enter a name: "
        ages[it] =
"\Enter an age: "
"\nPerson "
" - Name: "
", Age: "

Try copying and pasting the code inside Vizzcode and analyse the nodes that it'll generate. If you are having trouble understanding it, you can manually execute the code, like we have discussed before.
You can also see other examples that uses this technique such as the Tic Tac Toe game tutorial or the Querying Multiple Data programming exercise.

The Smallest Number
This challenge will use several programming features you learned so far, so give it your best shot!
If you are stuck, the following paragraphs will give you hints (similarly to the programming exercise).

You should iterate through the array (with a for loop, for example) to have a body of code work on the each and every element of the array.

Just like we did in the last tutorial, you can create a variable to store the first number and test all the values against that value. If it's smaller than the smallest number, it becomes the new smallest number!

Here is one solution to the challenge:

Using arrays to find the smallest number

Array Size
The array count is an expression you can use to avoid typing literal numbers (or magic numbers) in your program that have to be changed in case some other part of the program changes.
It's very common for programs to evolve and change during the development, and having to remember to change several different elements of the program when something else changes is very error-prone.
For example: if now you must read data from 50 users instead of 10, will you have to read your entire program looking for places you hard-coded the number 9 (size -1) to iterate through the array?
The array size is a way to automatically know the size of the array and is very useful in those cases. You can read more about it here.

Of course, now that you learned a (very important!) new skill, you should put that to good use by solving the Programming Exercises! The array exercises will guide you creating some very cool and useful programs, that will challenge you incrementally and make sure you are flexing your brain muscle!
When you are done, you can move on the last part of this tutorial series and learn about procedures!

Introduction To Programming: Part 9

This is last part of the "Introduction to Programming" series. You have come a long way! Congratulations!! Now, you will learn a versatile tool for organizing your program and even solving specific problems: procedures. With that, you will have all the tools to create more complex programs (even games!). What are you waiting for? Start Vizzcode and select this tutorial to begin!

Beyond the Main Procedure
The introduction of this tutorial gives you a basic understanding of what procedures are and why we use them.
In case it wasn't completely clear, you can access its documentation page or read a more detailed discussion on what procedures are and why use them.

The Structure of a Procedure
This tutorial page contains several important information on how you can create procedures. It's important that you read it carefully and re-read it multiple times if you need.
You already know how to create procedures (because you have created the main procedure - the entry point several times until now).

You can declare the procedure's parameters by adding a new variable node off the Parameters execution pin in the procedure node:

How to add parameters to a procedure in Vizzcode

You can read all about parameters here.
The same process can be applied to declare return values:

A procedure with parameters and return values

Here is the documentation page on return values.
Programming the body of the procedure is simply a matter of operating on the variables you receive as parameter, with the addition of a new node: the return statement. It's very useful and fundamental to returning values. You can read all about it here.

Lastly, you can also apply the method discussed previously to understand the program execution. When you are manually executing the code, remember to start in the main procedure's body and to jump to the sum procedure body whenever it is called. Also make sure you are keeping track of every variable's value, especially parameters, as well as their scopes.

Multiple Returns
This page expands what you have learned before about return values and introduce you to multiple return values.
It's very similar to a single return value in the procedure's body. A big distinction however, is that in order to read the multiple valued returned by a procedure, you must use a compound variable declaration. You can read all about them here in case you didn't understand them.

To consolidate this knowledge, you can create more procedures that execute code. For example:
  • Create a procedure that prints the message "I'm inside a procedure"
  • Create a procedure that prints an int that it receives as a parameter
  • Create a procedure that receives a float number and return its value squared

The Basics is Now Behind You and the World of Programming Ahead
What an incredible Victory!
You completed all the 9 tutorials of this course facing every challenge you found along the way. Congrats!
Like mentioned in the tutorial page inside Vizzcode, you can enter a new world of programming: making games! There are several tutorials on that advanced topic.
Again, the Programming exercises are a great way to practice your skills.
You can always check out what we are up to in Vizzcode's main page.
And of course, follow your own ideas to create interesting and new programs!
You can learn all about sharing your programs in this page!
We'll see you next time!