# Shorthand for values: variables

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Chapter 2 Shorthand for values: variables 2.1 Defining a variable You ve typed a lot of expressions into the computer involving pictures, but every time you need a different picture, you ve needed to find it (e.g. in a Web browser) and copy-andpaste it into DrRacket. This is repetitive and a pain. It would be much more convenient if you could give each picture a name and refer to it that way. To do this, DrRacket provides a built-in function named define. To see how it works, type (in the Interactions pane) the line > ( define calendar ) and hit ENTER/RETURN. You won t see any result, but now you can use the word calendar any time you want that picture: > calendar > (beside calendar calendar) > (flip-vertical calendar) (Note that if you leave out the space between define and calendar, or between beside and calendar, or between any two typed words, Racket won t know where one word ends and the next begins, and you ll get an error message like reference to undefined identifier: definecalendar.) There s nothing magical about the name calendar you could have named it anything else, like fred or antidisestablishmentarianism, but since it stands for a picture of a calendar, the name calendar is a lot easier to remember. Practice Exercise Define another variable to hold another picture you ve found 25

2 26 CHAPTER 2. VARIABLES on the Web. Write some expressions using each of the two variables, and some using both. You can also define a variable to hold the result of another expression, e.g. (define two-calendars (beside calendar calendar)) Practice Exercise Define a variable six-calendars whose value is a six-pack of calendars: two wide and three high. Test your definition by typing the name of the variable, all by itself, in the Interactions pane and hitting ENTER/RETURN; you should see the picture of six calendars. If not, you ve done something wrong. Hint: This is simpler if you use the already-defined the variable two-calendars. Practice Exercise Choose a reasonably small picture from this book or the Web, and store it in a variable. Then define another variable named two-copies whose value is two copies of that picture, side by side, by using the previous variable. Then define a third variable named six-copies whose value is a six-pack of the picture, two wide by three high, by using two-copies. Practice Exercise Construct another interesting picture from pieces in this book or on the Web, and store it in a variable with an appropriate name. Test it as before. If you use a particular piece more than once, you may want to give that piece a name of its own, so you can use its name in constructing the whole picture. Common beginner mistakes Recall from Chapter 1 that a literal is a simple expression that doesn t stand for anything else; if you type it into the Interactions window, the value you get back is the same thing you typed in. By contrast, a variable does stand for something else: if you type in the name of a variable, you get back a picture rather than the variable name you typed. You can only define a variable; you cannot define a literal. Furthermore, (in Beginner DrRacket) you cannot define a variable more than once: once you ve decided what value it stands for, that s its value until the next time you click Run. Practice Exercise Type each of the following expressions into a newly-opened interactions pane, one by one. For each one, predict what you think it will do, then hit ENTER and see whether you were right. Explain the results. Several of them will produce error messages: in each such case, read and understand the error message. calendar (define calendar) (define calendar calendar) (define calendar )

3 2.2. THE DEFINITIONS PANE 27 calendar (define other-pic book) (define other-pic calendar) (define calendar ) other-pic Note that when you type an expression to be evaluated, all variables in it must already be defined, or you get the error message reference to an identifier before its definition... On the other hand, when you define a variable, it must not already be defined, or you get the error message define: cannot redefine name... And of course, when you define a variable, it must be an identifier rather than a literal like, or you get the error message define: expected a function name, constant name, or function header for define, but found Defining variables and the Definitions pane As its name suggests, the Definitions pane(normally the top half of the DrRacket window) is intended to hold definitions. Try typing several variable definitions into the Definitions pane, then click the Run button. Everything you ve typed in the Interactions pane will disappear, but the variable definitions are available so you can use them as much as you wish in the Interactions pane. One benefit of this is that, once you ve found or constructed several interesting pictures, you can save them all to a file so you can easily work with the same named pictures again the next time you start DrRacket. Practice Exercise Type the (legal) definitions from Section 2.1 into the Definitions pane, save it to a file, quit DrRacket, double-click the file, and hit the Run button. Type some expressions involving those variables (calendar, two-calendars, etc.) into the Interactions pane and check that they do what you expect. 2.3 What s in a name? We ve been using the names of functions for some time already, and now we re making up new names for things. So what qualifies as a name? (The technical term in computer science is identifier.) The rules differ slightly from one programming language to another, but in Racket, an identifier can be made up of letters, numerals, and punctuation marks. It may not contain spaces, commas, # signs, parentheses, square brackets, curly braces, quotation marks, apostrophes, or vertical bars.

4 28 CHAPTER 2. VARIABLES An identifier may contain upper- and/or lower-case letters, and it makes a difference which one you use (e.g. calendar is different from Calendar or CALENDAR). An identifier may not consist entirely of numerals (if you type such a thing, DrRacket treats it as a number instead; we ll learn more about this in Chapter 3.) For example, rotate-cw is a legal identifier, which happens to represent a predefined function. rotate\$cw would also be a legal identifier, although it doesn t already stand for anything. rotate cw contains a space, so DrRacket would treat it as two identifiers, not one. 2.4 More syntax rules Why are these new expressions, involving define and defined variables, legal? Based on the grammar rules you ve seen so far (Syntax Rules 1 and 2 from Section 1.8), they re not. So we need some more syntax rules (for easy reference, we repeat the first two): Syntax Rule 1 Any literal picture is a legal expression; its value is itself. Syntax Rule 2 A left-parenthesis followed by a function name, one or more legal expressions, and a right parenthesis, is a legal expression. Its value is what you get by applying the named function to the values of the smaller expressions inside it. Syntax Rule 3 Any identifier, if already defined, is a legal expression. Its value is what it was defined to stand for. Syntax Rule 4 A left-parenthesis followed by the word define, a previously-undefined identifier, a legal expression, and a right-parenthesis is a legal expression. Think of it as anything matching the pattern (define new-identifier expression) It has no value, but the side effect of defining the variable to stand for the value of the expression. Worked Exercise Draw a box diagram to prove that ( define calendar ) is a legal expression. Assume that calendar is not already defined. Solution: The picture is obviously a legal expression, by rule 1: 1 (define calendar ) The word calendar is a legal identifier. It does not qualify as a legal expression in its own right, since it isn t already defined; however, by rule 4 an undefined identifier can be combined with define and the picture to make a legal expression. 4 1 (define calendar )

5 2.5. VARIABLES AND THE STEPPER 29 Exercise Draw a box diagram to prove that ( rotate-cw calendar ) is a legal expression. Assume that calendar is already defined. Exercise Draw a box diagram to prove that your solution to Exercise or is a legal expression. Exercise Draw a box diagram for ( define snark boojum calendar) Assume that calendar is already defined, and snark and boojum are not. The whole thing is not a legal expression; why not? 2.5 Variables and the Stepper Variable definitions provide another opportunity to see what s going on behind the scenes by using the Stepper. Make sure you ve got some variable definitions in the Definitions pane, then add some expressions at the end like ( beside (flip-vertical calendar) calendar ) Click the Step button. It ll skip over all the simple definitions, until you get to an expression involving Syntax Rule 2 (applying a function to something) or 3 (getting the value of a variable). Any variable names in the original expression will be replaced (one by one) with the values of those variables, and then the function (if any) can be applied as usual. Practice Exercise Make up some expressions involving variables, type them into the Definitions window, and step through them. At each step, make sure you understand what s being replaced with what, and why. 2.6 Review of important words and concepts A variable is a word that stands for some other value. An identifier is any word; it may contain some punctuation marks, but it cannot contain spaces, parentheses, quotation marks, or commas. Every variable is an identifier, but not every identifier is a variable. For example, define, rotate-180, beside, etc. are identifiers but not variables: they stand for operations rather than values. A variable can be defined by using Syntax Rule 4 on a previously-undefined identifier. After that, you can use it anywhere that you could use any other expression, according to Syntax Rule 2. By chaining a sequence of variable definitions, you can build complex pictures without getting nearly as confused as you might if you tried to write the whole thing as one big expression. 2.7 Reference: functions for defining variables The only new function introduced in this chapter is define.

### Animations involving numbers

136 Chapter 8 Animations involving numbers 8.1 Model and view The examples of Chapter 6 all compute the next picture in the animation from the previous picture. This turns out to be a rather restrictive

### The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

Mr G s Java Jive #2: Yo! Our First Program With this handout you ll write your first program, which we ll call Yo. Programs, Classes, and Objects, Oh My! People regularly refer to Java as a language that

### Input, output, and sequence

Chapter 29 Input, output, and sequence For this chapter, switch languages in DrRacket to Advanced Student Language. In the real world, we don t usually give a computer all the information it needs, all

### Intro. Scheme Basics. scm> 5 5. scm>

Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

### 1 Getting started with Processing

cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

### CMSC 201 Fall 2016 Lab 09 Advanced Debugging

CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working

### The compiler is spewing error messages.

Appendix B Debugging There are a few different kinds of errors that can occur in a program, and it is useful to distinguish between them in order to track them down more quickly. Compile-time errors are

### Properties and Definitions

Section 0.1 Contents: Operations Defined Multiplication as an Abbreviation Visualizing Multiplication Commutative Properties Parentheses Associative Properties Identities Zero Product Answers to Exercises

### Functions that return lists

342 Chapter 23 Functions that return lists If you did exercises 22.5.15 or 22.5.16, you ve already written some functions that return lists, but only in a very simple way: adding one new element to the

### CS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style

CS125 : Introduction to Computer Science Lecture Notes #4 Type Checking, Input/Output, and Programming Style c 2005, 2004, 2002, 2001, 2000 Jason Zych 1 Lecture 4 : Type Checking, Input/Output, and Programming

### Have the students look at the editor on their computers. Refer to overhead projector as necessary.

Intro to Programming (Time 15 minutes) Open the programming tool of your choice: If you ve installed, DrRacket, double-click the application to launch it. If you are using the online-tool, click here to

### OrbBasic Lesson 1 Goto and Variables: Student Guide

OrbBasic Lesson 1 Goto and Variables: Student Guide Sphero MacroLab is a really cool app to give the Sphero commands, but it s limited in what it can do. You give it a list of commands and it starts at

### Part II Composition of Functions

Part II Composition of Functions The big idea in this part of the book is deceptively simple. It s that we can take the value returned by one function and use it as an argument to another function. By

### CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed

### L A TEX Primer. Randall R. Holmes. August 17, 2018

L A TEX Primer Randall R. Holmes August 17, 2018 Note: For this to make sense it needs to be read with the code and the compiled output side by side. And in order for the compiling to be successful, the

### OrbBasic 1: Student Guide

OrbBasic 1: Student Guide Sphero MacroLab is a really cool app to give the Sphero commands, but it s limited in what it can do. You give it a list of commands and it starts at the top and goes to the bottom,

### Section 0.3 The Order of Operations

Section 0.3 The Contents: Evaluating an Expression Grouping Symbols OPERATIONS The Distributive Property Answers Focus Exercises Let s be reminded of those operations seen thus far in the course: Operation

### Section 1. The essence of COBOL programming. Mike Murach & Associates

Chapter 1 Introduction to COBOL programming 1 Section 1 The essence of COBOL programming The best way to learn COBOL programming is to start doing it, and that s the approach the chapters in this section

### Excel Basics: Working with Spreadsheets

Excel Basics: Working with Spreadsheets E 890 / 1 Unravel the Mysteries of Cells, Rows, Ranges, Formulas and More Spreadsheets are all about numbers: they help us keep track of figures and make calculations.

### 1.2 Adding Integers. Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line

1.2 Adding Integers Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line Finding Sums Mentally The Commutative Property Finding Sums using And Patterns and Rules of Adding Signed

### Lab 1: Setup 12:00 PM, Sep 10, 2017

CS17 Integrated Introduction to Computer Science Hughes Lab 1: Setup 12:00 PM, Sep 10, 2017 Contents 1 Your friendly lab TAs 1 2 Pair programming 1 3 Welcome to lab 2 4 The file system 2 5 Intro to terminal

### Chapter 1: Getting Started

Chapter 1: Getting Started 1 Chapter 1 Getting Started In OpenOffice.org, macros and dialogs are stored in documents and libraries. The included integrated development environment (IDE) is used to create

### Programming with Python

Programming with Python Dr Ben Dudson Department of Physics, University of York 21st January 2011 http://www-users.york.ac.uk/ bd512/teaching.shtml Dr Ben Dudson Introduction to Programming - Lecture 2

### Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple

### 9 R1 Get another piece of paper. We re going to have fun keeping track of (inaudible). Um How much time do you have? Are you getting tired?

Page: 1 of 14 1 R1 And this is tell me what this is? 2 Stephanie x times y plus x times y or hm? 3 R1 What are you thinking? 4 Stephanie I don t know. 5 R1 Tell me what you re thinking. 6 Stephanie Well.

### Software Design and Analysis for Engineers

Software Design and Analysis for Engineers by Dr. Lesley Shannon Email: lshannon@ensc.sfu.ca Course Website: http://www.ensc.sfu.ca/~lshannon/courses/ensc251 Simon Fraser University Slide Set: 9 Date:

### CS Problem Solving and Object-Oriented Programming

CS 101 - Problem Solving and Object-Oriented Programming Lab 5 - Draw a Penguin Due: October 28/29 Pre-lab Preparation Before coming to lab, you are expected to have: Read Bruce chapters 1-3 Introduction

### Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials

Fundamentals We build up instructions from three types of materials Constants Expressions Fundamentals Constants are just that, they are values that don t change as our macros are executing Fundamentals

### VLOOKUP() takes three mandatory parameters and one default/optional parameter:

Excel Lesson: Table Lookup Functions Topics Covered: VLookup() [Look across] HLookup() [Look down] Lookup() [Look almost anywhere] Related Functions (a list) We will not be examining all forms of these

### Text Input and Conditionals

Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()

### Initial Coding Guidelines

Initial Coding Guidelines ITK 168 (Lim) This handout specifies coding guidelines for programs in ITK 168. You are expected to follow these guidelines precisely for all lecture programs, and for lab programs.

### Creating a new form with check boxes, drop-down list boxes, and text box fill-ins. Customizing each of the three form fields.

In This Chapter Creating a new form with check boxes, drop-down list boxes, and text box fill-ins. Customizing each of the three form fields. Adding help text to any field to assist users as they fill

### Animations that make decisions

Chapter 17 Animations that make decisions 17.1 String decisions Worked Exercise 17.1.1 Develop an animation of a simple traffic light. It should initially show a green disk; after 5 seconds, it should

### Arrays/Branching Statements Tutorial:

Arrays/Branching Statements Tutorial: In the last tutorial, you created a button that, when you clicked on it (the onclick event), changed another image on the page. What if you have a series of pictures

### Conditionals. Chapter Making decisions

206 Chapter 15 Conditionals 15.1 Making decisions We saw in Chapter 13 how to write functions that answer yes/no questions, and we saw in Chapter 14 how to use such a function as the stopping criterion

### You just told Matlab to create two strings of letters 'I have no idea what I m doing' and to name those strings str1 and str2.

Chapter 2: Strings and Vectors str1 = 'this is all new to me' str2='i have no clue what I am doing' str1 = this is all new to me str2 = I have no clue what I am doing You just told Matlab to create two

### 1. Please, please, please look at the style sheets job aid that I sent to you some time ago in conjunction with this document.

1. Please, please, please look at the style sheets job aid that I sent to you some time ago in conjunction with this document. 2. W3Schools has a lovely html tutorial here (it s worth the time): http://www.w3schools.com/html/default.asp

### SPRITES Moving Two At the Same Using Game State

If you recall our collision detection lesson, you ll likely remember that you couldn t move both sprites at the same time unless you hit a movement key for each at exactly the same time. Why was that?

### VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.

Lesson 2 VARIABLES Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. WHAT ARE VARIABLES? When you input data (i.e. information) into a computer

### ORB Education Quality Teaching Resources

JavaScript is one of the programming languages that make things happen in a web page. It is a fantastic way for students to get to grips with some of the basics of programming, whilst opening the door

### Fundamentals: Expressions and Assignment

Fundamentals: Expressions and Assignment A typical Python program is made up of one or more statements, which are executed, or run, by a Python console (also known as a shell) for their side effects e.g,

### MySQL: an application

Data Types and other stuff you should know in order to amaze and dazzle your friends at parties after you finally give up that dream of being a magician and stop making ridiculous balloon animals and begin

### RACKET BASICS, ORDER OF EVALUATION, RECURSION 1

RACKET BASICS, ORDER OF EVALUATION, RECURSION 1 COMPUTER SCIENCE 61AS 1. What is functional programming? Give an example of a function below: Functional Programming In functional programming, you do not

### Creating a Brochure in Publisher

Creating a Brochure in Publisher If you closed the Flyer, as indicated above, you will see the Microsoft Publisher Task Pane on the left side of your screen. Click the Brochures selection in the Publication

### CS1046 Lab 4. Timing: This lab should take you 85 to 130 minutes. Objectives: By the end of this lab you should be able to:

CS1046 Lab 4 Timing: This lab should take you 85 to 130 minutes. Objectives: By the end of this lab you should be able to: Define the terms: function, calling and user-defined function and predefined function

### Decisions, Decisions. Testing, testing C H A P T E R 7

C H A P T E R 7 In the first few chapters, we saw some of the basic building blocks of a program. We can now make a program with input, processing, and output. We can even make our input and output a little

### These are notes for the third lecture; if statements and loops.

These are notes for the third lecture; if statements and loops. 1 Yeah, this is going to be the second slide in a lot of lectures. 2 - Dominant language for desktop application development - Most modern

### 1.7 Limit of a Function

1.7 Limit of a Function We will discuss the following in this section: 1. Limit Notation 2. Finding a it numerically 3. Right and Left Hand Limits 4. Infinite Limits Consider the following graph Notation:

### For this chapter, switch languages in DrRacket to Advanced Student Language.

Chapter 30 Mutation For this chapter, switch languages in DrRacket to Advanced Student Language. 30.1 Remembering changes Suppose you wanted to keep track of a grocery shopping list. You could easily define

### Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

### 2 Sets. 2.1 Notation. last edited January 26, 2016

2 Sets Sets show up in virtually every topic in mathematics, and so understanding their basics is a necessity for understanding advanced mathematics. As far as we re concerned, the word set means what

### We know have to navigate between Karel s World view, Karel s Program view and Karel s Execution (or Run) view.

We know how to write programs using Karel s primitive commands move turnleft pickbeeper putbeeper turnoff We know have to navigate between Karel s World view, Karel s Program view and Karel s Execution

### 9. MATHEMATICIANS ARE FOND OF COLLECTIONS

get the complete book: http://wwwonemathematicalcatorg/getfulltextfullbookhtm 9 MATHEMATICIANS ARE FOND OF COLLECTIONS collections Collections are extremely important in life: when we group together objects

### Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

Hello World! Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande Chapter 1 Copyright 2009 Manning Publications brief contents Preface xiii Acknowledgments xix About this

### Programming for the Non-Programmer Examples of programming concepts and terms for the rest of us. Laurie Weaver

Programming for the Non-Programmer Examples of programming concepts and terms for the rest of us Laurie Weaver Programming for the Non-Programmer Programming and programmers can seem very mysterious to

### Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122

Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122 I. Logic 101 In logic, a statement or proposition is a sentence that can either be true or false. A predicate is a sentence in

### Using Flash Animation Basics

Using Flash Contents Using Flash... 1 Animation Basics... 1 Exercise 1. Creating a Symbol... 2 Exercise 2. Working with Layers... 4 Exercise 3. Using the Timeline... 6 Exercise 4. Previewing an animation...

### Introduction to Programming with JES

Introduction to Programming with JES Titus Winters & Josef Spjut October 6, 2005 1 Introduction First off, welcome to UCR, and congratulations on becoming a Computer Engineering major. Excellent choice.

### How to Make a Book Interior File

How to Make a Book Interior File These instructions are for paperbacks or ebooks that are supposed to be a duplicate of paperback copies. (Note: This is not for getting a document ready for Kindle or for

### CISC-124. Casting. // this would fail because we can t assign a double value to an int // variable

CISC-124 20180122 Today we looked at casting, conditionals and loops. Casting Casting is a simple method for converting one type of number to another, when the original type cannot be simply assigned to

### Working with Track Changes: A Guide

Working with Track Changes: A Guide Prepared by Chris Cameron & Lesley-Anne Longo The Editing Company Working with Track Changes: A Guide While many people may think of editors hunched over their desks,

### Outlook is easier to use than you might think; it also does a lot more than. Fundamental Features: How Did You Ever Do without Outlook?

04 537598 Ch01.qxd 9/2/03 9:46 AM Page 11 Chapter 1 Fundamental Features: How Did You Ever Do without Outlook? In This Chapter Reading e-mail Answering e-mail Creating new e-mail Entering an appointment

### Statistics Case Study 2000 M. J. Clancy and M. C. Linn

Statistics Case Study 2000 M. J. Clancy and M. C. Linn Problem Write and test functions to compute the following statistics for a nonempty list of numeric values: The mean, or average value, is computed

### 3Using and Writing. Functions. Understanding Functions 41. In this chapter, I ll explain what functions are and how to use them.

3Using and Writing Functions Understanding Functions 41 Using Methods 42 Writing Custom Functions 46 Understanding Modular Functions 49 Making a Function Modular 50 Making a Function Return a Value 59

### COPYRIGHTED MATERIAL. Getting Started with Google Analytics. P a r t

P a r t I Getting Started with Google Analytics As analytics applications go, Google Analytics is probably the easiest (or at least one of the easiest) available in the market today. But don t let the

### Installing Dolphin on Your PC

Installing Dolphin on Your PC Note: When installing Dolphin as a test platform on the PC there are a few things you can overlook. Thus, this installation guide won t help you with installing Dolphin on

### Difference Between Dates Case Study 2002 M. J. Clancy and M. C. Linn

Difference Between Dates Case Study 2002 M. J. Clancy and M. C. Linn Problem Write and test a Scheme program to compute how many days are spanned by two given days. The program will include a procedure

### QUICK EXCEL TUTORIAL. The Very Basics

QUICK EXCEL TUTORIAL The Very Basics You Are Here. Titles & Column Headers Merging Cells Text Alignment When we work on spread sheets we often need to have a title and/or header clearly visible. Merge

### Table of Laplace Transforms

Table of Laplace Transforms 1 1 2 3 4, p > -1 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Heaviside Function 27 28. Dirac Delta Function 29 30. 31 32. 1 33 34. 35 36. 37 Laplace Transforms

Your First Windows Form From now on, we re going to be creating Windows Forms Applications, rather than Console Applications. Windows Forms Applications make use of something called a Form. The Form is

Adding content to your Blackboard 9.1 class There are quite a few options listed when you click the Build Content button in your class, but you ll probably only use a couple of them most of the time. Note

### Section 1.1 Definitions and Properties

Section 1.1 Definitions and Properties Objectives In this section, you will learn to: To successfully complete this section, you need to understand: Abbreviate repeated addition using Exponents and Square

### Variables, expressions and statements

Variables, expressions and statements 2.1. Values and data types A value is one of the fundamental things like a letter or a number that a program manipulates. The values we have seen so far are 2 (the

### Coordinate System Techniques

Coordinate System Techniques In this lesson, we ll show some advanced implications of what can be done with coordinate systems. For the most part, this lesson applies to machining centers. But there are

### Boolean Expressions. Is Equal and Is Not Equal

3 MAKING CHOICES Now that we ve covered how to create constants and variables, you re ready to learn how to tell your computer to make choices. This chapter is about controlling the flow of a computer

### QUIZ. What is wrong with this code that uses default arguments?

QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code

### Robotics II. Module 5: Creating Custom Made Blocks (My Blocks)

Robotics II Module 5: Creating Custom Made Blocks (My Blocks) PREPARED BY Academic Services Unit December 2011 Applied Technology High Schools, 2011 Module 5: Creating Custom Made Blocks (My Blocks) Module

### The Dynamic Typing Interlude

CHAPTER 6 The Dynamic Typing Interlude In the prior chapter, we began exploring Python s core object types in depth with a look at Python numbers. We ll resume our object type tour in the next chapter,

### Boolean Expressions. Is Equal and Is Not Equal

3 MAKING CHOICES ow that we ve covered how to create constants and variables, you re ready to learn how to tell your computer to make choices. This chapter is about controlling the flow of a computer program

### (Refer Slide Time 3:31)

Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 5 Logic Simplification In the last lecture we talked about logic functions

### Lecture 4 CSE July 1992

Lecture 4 CSE 110 6 July 1992 1 More Operators C has many operators. Some of them, like +, are binary, which means that they require two operands, as in 4 + 5. Others are unary, which means they require

### Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Table of Contents Introduction!... 1 Part 1: Entering Data!... 2 1.a: Typing!... 2 1.b: Editing

### 2 Adding Contacts, Sending Attachment s and Sending s to More Than 1 Person.

E-Mail 2 Adding Contacts, Sending Attachment s and Sending E-Mail s to More Than 1 Person. 1 The first thing we are going to do is check our inbox for any unread e-mails. To do this we need to go on Internet

### STATS 507 Data Analysis in Python. Lecture 2: Functions, Conditionals, Recursion and Iteration

STATS 507 Data Analysis in Python Lecture 2: Functions, Conditionals, Recursion and Iteration Functions in Python We ve already seen examples of functions: e.g., type()and print() Function calls take the

### This chapter is intended to take you through the basic steps of using the Visual Basic

CHAPTER 1 The Basics This chapter is intended to take you through the basic steps of using the Visual Basic Editor window and writing a simple piece of VBA code. It will show you how to use the Visual

### 12 Macros. Localmake. is an abbreviation for the two instructions. localmake "fred 87. local "fred make "fred 87

12 Macros I mentioned that the versions of for and foreach shown in Chapter 10 don t work if their instruction templates include stop or output commands. The problem is that we don t want, say, foreach

### Chapter 17. Fundamental Concepts Expressed in JavaScript

Chapter 17 Fundamental Concepts Expressed in JavaScript Learning Objectives Tell the difference between name, value, and variable List three basic data types and the rules for specifying them in a program

### COMP : Practical 9 ActionScript: Text and Input

COMP126-2006: Practical 9 ActionScript: Text and Input This practical exercise includes two separate parts. The first is about text ; looking at the different kinds of text field that Flash supports: static,

### CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday

### Homework 7: Subsets Due: 11:59 PM, Oct 23, 2018

CS17 Integrated Introduction to Computer Science Klein Contents Homework 7: Subsets Due: 11:59 PM, Oct 23, 2018 1 Bookends (Practice) 2 2 Subsets 3 3 Subset Sum 4 4 k-subsets 5 5 k-subset Sum 5 Objectives

### STAT 113: R/RStudio Intro

STAT 113: R/RStudio Intro Colin Reimer Dawson Last Revised September 1, 2017 1 Starting R/RStudio There are two ways you can run the software we will be using for labs, R and RStudio. Option 1 is to log

### SIMPLE INPUT and OUTPUT:

SIMPLE INPUT and OUTPUT: (A) Printing to the screen. The disp( ) command. If you want to print out the values of a variable to the screen, you simply can type the variable at the command line. > x = 5

### Defining Program Syntax. Chapter Two Modern Programming Languages, 2nd ed. 1

Defining Program Syntax Chapter Two Modern Programming Languages, 2nd ed. 1 Syntax And Semantics Programming language syntax: how programs look, their form and structure Syntax is defined using a kind

### CSC 467 Lecture 3: Regular Expressions

CSC 467 Lecture 3: Regular Expressions Recall How we build a lexer by hand o Use fgetc/mmap to read input o Use a big switch to match patterns Homework exercise static TokenKind identifier( TokenKind token

### CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output

CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output Last revised January 12, 2006 Objectives: 1. To introduce arithmetic operators and expressions 2. To introduce variables

### Starting Boolean Algebra

Boolean Algebra March 2, 27 Diagram for FunChip2 Here is a picture of FunChip2 that we created more or less randomly in class on /25 (used in various Activities): Starting Boolean Algebra Boolean algebra

Table of Contents 4 5 6 7 8 9 0 Introduction Getting Setup Your first PHP webpage Working with text Talking to the user Comparison & If statements If & Else Cleaning up the game Remembering values Finishing