Last week, we covered the basics of the lists in Computer Science. A common operation on lists is traversal of the list. Traversal is the process of accessing each element of a list in order and performing some operation. Let’s see how we can do it in SNAP!. While accessing each […]
Category: Introduction to Computer Science
I will use SNAP! for the Introduction to Computer series. It has simple drag-and-drop visual interface. With this series, I want readers to focus more on the concepts of computer science than the semantics of the language used.
In the future series, I will go to a text based programming language.
If you are starting from scratch and no prior knowledge of computer science, I would recommend that you go through the blogs in the order specified here.
Introduction to List in SNAP!
We use lists every day. The most common list we use our life is a shopping list. In this blog, we will see how lists can be represented in Computer Science (specifically SNAP!). Characteristics of Lists Before we jump into how we represent lists in Computer Science, let’s discuss what […]
Using Loops in combination with Conditionals
This week, let’s discuss combining two concepts we have learnt in the last few weeks: loops and conditionals. As discussed in those blog posts, loops are used to execute a code of block multiple times and conditionals are used to define if a particular block of code will be executed […]
Boolean Expressions and Operators
In the last few blocks, we learnt about predicate blocks and conditional blocks. What is one thing common in both of them? Well, predicate blocks evaluate to a boolean value, that is true or false, and conditional blocks use boolean expressions or values to define the code flow. In this blog, we will deep-dive into the boolean […]
Introducing Conditional Blocks
Although I have been using conditional blocks in many of my blogs/lessons, I forgot that I have never formally introduced conditional blocks so far:). So let’s cover those today. The idea of conditional blocks is pretty straight-forward and intuitive. Conditional blocks are the blocks used to make a choice between the […]
Using Loops with Inputs
Last week, we covered what is a nested loop and how to implement it in SNAP! In the program we developed last week, we had minimal user activity. We defined the problem to draw 2 squares next to each other, and hard coded the number of squares as 2 in the […]
Using Nested Loops
In the blog post, Using Loops, we discussed that loop is a type of block which is used to run code multiple times. It is useful in reducing code redundancy and increase readability when dealing with repetitive tasks. Continuing to build on the example of drawing a square, what if […]
Predicate Blocks in SNAP!
In the beginning of the year, we discussed Reporter Blocks and their use cases. Today lets’s talk about a special type of Reporter Blocks, known as Predicate blocks. Predicate blocks are of trapezoidal shape and must return true or false. Some of the examples of predicate blocks in Operators palette are: and in Sensing palette are: […]
Using Loops
In computer science, Loops is a type of block that causes other code to run multiple times in succession. A program can be written in many different ways that are functionally equivalent. Last week, we learned how to draw shapes using SNAP! As an exercise, we wrote the script to draw […]
Draw Shapes in SNAP!
Let’s have some fun today and draw some shapes in SNAP! For the purpose of this post, I will use the following 2 blocks in Pen palette: However, I do encourage you to play around with other blocks as well in this palette and test what they can do. Let’s […]