Starting from Scratch pt.1
In my recent dive into expanding my code-base knowledge I’ve utilized the HarvardX: CS50's Introduction to Computer Science class online. With the first week done we’ve been introduced to Scratch a coding language developed by MIT & through the lovely GUI have managed to piece together the building blocks of what Computer Science is.
Scratch itself is a “block-based” programming language that is used to create programs with a graphic user interface based on a “building-block” motif. It was established to help children & other young people creatively think and learn skills essential for software engineering at an early age/stage. The basis is to teach strategies and problem solving while designing projects and sharing those with their peers & teachers.
Diving into our first application we’ll have Giga (our sprite pictured below) Take in user input & return an answer to in the form of a greeting back to the user.
We’ll start with adding a block that is in the event tab for what to do when the “start” flag is clicked. Next we’ll add a looks piece with the say feature so Giga can introduce themselves. The white spaces add for customization of the text Giga will speak & then in the sensing tab we can add a custom question “ask ‘what’s your name? followed by a wait command’”
After the wait command is given we see a separate bubble titled “answer” which is a variable that contains the input from the user. This concept we see across all other programming languages. With a simple blocks added we can expand our source code to where sound pops up with each input box and Giga even changes their facial expressions.
And just like that we’ve utilized Scratch to program a sprite to ask a question and accept user input -> store inside a variable called answer and utilize that answer to address the user by what was stored!