Getting started
Using the computer as a calculator This command asks the computer to add 3+4. 3.0 + 4.0
When typing numbers, be sure to type decimal point. Otherwise strange things will happen (try removing one of the decimal points and notice the complaint in the Output Window). Other arithmetic operators (don't memorize these now, we'll come back to them later):
Using variables as value holdersBelow we store the result of 3+4 in a variable called a. When reading these commands aloud, we pronounce < as "gets" and say the entire command as the following sentence "a gets 3 + 4". (try it) The following just computes a + 1, which is 8, but doesn't change a. (try it)
Now, let's check that a has not changed (try it)
If we want to change a, we can just specify the command a gets a plus 1 as follows (try it)
Drawing a dotIn iMPaCT projects, students write tiny programs to represent the problems that they need to solve. The most basic element of this is drawing a dot. The following program draws a single dot at position (50.0, 25.0).
A few notes:
Erasing the graphThe clear() command erases everything on the graph. (try it)
Drawing a line (part 1)The following progam draws a line of length 20 as a sequence of dots. Before you try running it, answer for yourself: What will the program draw?
Using variables and arithmetic to simplifySince we have copyandpaste, it would be far simpler if we could use the exact same statement to draw each dot. However, to do this, the dot commands can't explicity specify the column number. Todo do this, we will intead store the column number in variable x as follows: (try it)
Thinkers challenge: Try changing the program to draw a sequence of six blue dots in a horizontal row starting from (80, 22) at interval 10. Using a while statement to control rangeOur last step is to exploit the while statement to conveniently repeat dot and addition statements until all the desired dots are drawn. This time, we will draw one dot per column and start from (15,20) and end at (15,40). (try it)
Thinker's challenge: modify this program to draw a line from (30,50) to (70, 50). Hinting at vectorsWe won't tell you what this program does. Please draw what you think it will do before you try it.

iMPaCT try f# >