Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hackety Hack! Written by Krystal Salerno Presented by _______________.

Similar presentations


Presentation on theme: "Hackety Hack! Written by Krystal Salerno Presented by _______________."— Presentation transcript:

1 Hackety Hack! Written by Krystal Salerno Presented by _______________

2 What is Hackety Hack? Hackety Hack is a cool Ruby-based program that makes it really easy and fun to learn coding! You can get it at home and work on it too! www.hackety.com

3 Let’s get started! 1.Click on Start 2.Click All Programs 3.Open Hackety Hack 4.Click on the Hackety Hack program If you can’t find it, let us know!

4 The basics We are going to make a simple program that just says hello! alert “Hello ambassador!” Click on Run in the bottom corner and watch!

5 What is a variable? Variables are things that we can change for the computer to read name = “Bob” alert “My name is ” + name Click Run!

6 Asking questions: We can have the computer ask us questions too! name = ask “What is your name?” alert “Your name is ” + name Click on Run!

7 Let’s draw! We can make the computer draw shapes with a few commands. Let’s use Turtle to draw a simple square.

8 Let’s draw! Turtle.start do forward 50 turnright 90 end Click Run and see what happens.

9 Let’s draw! So we only got a line, and a square has 4. How can we fix it? Let’s copy this 4 times forward 50 turnright 90

10 Let’s draw! Turtle.start do forward 50 turnright 90 forward 50 turnright 90 forward 50 turnright 90 forward 50 turnright 90 end

11 Let’s draw! This takes too long to do, especially with more sides, so we can tell the computer to repeat itself. When we do this we call it a loop. We can also change the colors of the background and the line Turtle makes!

12 Loopity Loop Turtle.start do background maroon pencolor honeydew 4.times do forward 50 turnright 90 end

13 Loopity Loop See how much nicer that makes it! Let’s play with the numbers we have after forward and turnright and see what happens.

14 Strings and Integers Who knows what the difference between “1000” and 1000 is?

15 Strings and Integers “1000” is a string (The quotes “” are the key) 1000 is an integer Strings are words or letters, must have quotes Integers are only whole numbers

16 Strings and Integers If we tried to do a math problem with this: “1000” + 1 = … The computer would give us an error, we tried adding the word “one thousand” and 1, it won’t work...

17 Strings and Integers If we want to change “1000” to 1000, then we need to use a special command. to_i and to_s will do the trick! “1000”.to_i = 1000 1000.to_s = “1000”

18 Lets Try It! Clear your editor, and let’s ask a question sides = ask “How many sides?” Then let’s see how we can use this in the Turtle program!

19 Lets Try It! sides = ask “How many sides?” Turtle.start do sides.to_i.times do forward 50 turnright 40 end

20 Ask More Questions sides = ask “How many sides?” steps = ask “How much should we turn?” Turtle.start do sides.to_i.times do forward 50 turnright steps.to_i end

21 Ask More Questions sides = ask “How many sides?” Turtle.start do sides.to_i.times do forward 50 turnright 360/sides.to_i end

22 Calculators We can make small calculators with this too! number1 = ask “First number?” number2 = ask “Second number?” alert number1.to_i + number2.to_i

23 Follow us on Social Media! #FITC & visit fitc.cci.fsu.edu /FITCAlliance @FITCAlliance @FITC_Alliance FITC Group


Download ppt "Hackety Hack! Written by Krystal Salerno Presented by _______________."

Similar presentations


Ads by Google