Utah State Variables, Debugging, Control Structures.

Slides:



Advertisements
Similar presentations
Chapter 4 - Control Statements
Advertisements

Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 4 Making Decisions in a Program.
Team 5220 Roboknights. Outline  Getting Started  Hardware Setup/Wiring  Software Setup/Pragmas  Programming with RobotC  Grammar/Syntax  Basic Statements.
Decisions (Conditional Programming) Chapter 5 (Sec. 5.1 & 5.2)
B.Sc. Multimedia ComputingMultimedia Authoring Introduction to ActionScript.
If Statements Sections 1.25, Control Structures o All code thus far executes every line of code sequentially o We want to be able to repeat,
B.Sc. Multimedia ComputingMultimedia Authoring Introduction to ActionScript 3.0.
Loops – While, Do, For Repetition Statements Introduction to Arrays
Utah State Topics Using variables Debugging Control structures (if statements) The _currentframe property Library folders.
Loops Repetition Statements. Repetition statements allow us to execute a statement multiple times Often they are referred to as loops Like conditional.
© 2004 Pearson Addison-Wesley. All rights reserved5-1 Iterations/ Loops The while Statement Other Repetition Statements.
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
An Introduction to C Programming Geb Thomas. Learning Objectives Learn how to write and compile a C program Learn what C libraries are Understand the.
CS 11 C track: lecture 1 Preliminaries Need a CS cluster account cgi-bin/sysadmin/account_request.cgi Need to know UNIX ITS.
CONTROL STATEMENTS IF-ELSE, SWITCH- CASE Introduction to Computer Science I - COMP 1005, 1405 Instructor : Behnam Hajian
Python Programming Using Variables and input. Objectives We’re learning to make use of if statements to enable code to ask questions. Outcomes Build an.
Python – Making Decisions Lecture 02. Control Structures A program that only has one flow is useful but limited. We can use if statements to make these.
 Input and Output Functions Input and Output Functions  OperatorsOperators Arithmetic Operators Assignment Operators Relational Operators Logical Operators.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Liang, Introduction to Programming with C++, Second Edition, (c) 2010 Pearson Education, Inc. All rights reserved Chapter 3 Selections.
1 Conditions Logical Expressions Selection Control Structures Chapter 5.
Monday, Jan 13, 2003Kate Gregory with material from Deitel and Deitel Week 2 Questions from Last Week Control Structures Functions Lab 1.
 Java has the logical operators and, or, and not, symbolized by &&, ||, and !, respectively.  Logical or means one or the other or both conditions hold.
1. We’ve learned that our programs are read by the compiler in order, from top to bottom, just as they are written The order of statement execution is.
5-1 Repetition Statements Repetition statements allow us to execute a statement multiple times Often they are referred to as loops Like conditional statements,
Making Decisions (True or False) Relational Operators >greater than =greater than or equal to
CS Class 05 Topics  Selection: switch statement Announcements  Read pages 74-83, ,
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Selection Statements Selection Switch Conditional.
Liang, Introduction to C++ Programming, (c) 2007 Pearson Education, Inc. All rights reserved X1 Chapter 3 Control Statements.
Repetition. Control of Flow SEQUENCE SELECTION (if..else, switch…case) REPETITION.
Programming 101 EPGY Middle School Programming Adam Leeper.
Topic 3: C Basics CSE 30: Computer Organization and Systems Programming Winter 2011 Prof. Ryan Kastner Dept. of Computer Science and Engineering University.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
Pascal Programming Pascal Loops and Debugging. Pascal Programming Pascal Loops In our first brush with the while do loops, simple comparisons were used.
Conditional Statements © Copyright 2014, Fred McClurg All Rights Reserved.
Introduction to Web Frontend Development with JavaScript.
CECS 5020 Computers in Education Visual Basic Variables and Constants.
Chapter 2 Programming with PHP Part 2. handle_form.php Script 2.3 on pages 46 cript_02_03/form.html
A Level Computing#BristolMet Session Objectives#U2 S3 MUST use/read programme flow charts accurately SHOULD adapt the calculator programme to include a.
Controlling Program Flow with Decision Structures.
Flow of Control: Loops Module 4. Objectives Design a loop Use while, do, and for in a program Use the for-each with enumerations Use assertion checks.
CSE202: Lecture 5The Ohio State University1 Selection Structures.
CS100Lecture 21 Announcements For homework due Thursday, work alone -- do not work in pairs New class location: Olin 155 Office hour oops! Lyn: MW, 11:15-12:15.
Data Mangling The key to data-management within your Flex Applications.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. 4 Simple Flow of Control.
JavaScript: Conditionals contd.
The Ohio State University
Basic concepts of C++ Presented by Prof. Satyajit De
Topic 02: Introduction to ActionScript 3.0
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Debugging and Random Numbers
Loop Structures.
Chapter 3 Control Statements Lecturer: Mrs Rohani Hassan
CS106A, Stanford University
I Know What I Want to Do – Now What??
Web Systems Development (CSC-215)
ICS 3U Tuesday, September 21st.
Programming with PHP Part 2
Visual Basic – Decision Statements
Selection Statements.
CISC124 Labs start this week in JEFF 155. Fall 2018
Conditional Statements with JavaScript
There many situations comes in real life when we need to make some decisions and based on these decisions, we decide what should we do next. Similar situations.
Decisions, decisions, decisions
design OO words Debug Variables Data types
Perl Programming Dr Claire Lambert
Chapter 3 Flow of Control Loops in Java.
The for Loop © 2018 Kris Jordan.
CISC 110 Day 2 Programming Basics.
Presentation transcript:

Utah State Variables, Debugging, Control Structures

Utah State Topics Using variables Debugging Control structures (if statements) The currentFrame property Library folders

Utah State Variables/Properties Placeholders for information Name Value Type Flash Card analogy. Flash syntax: var variableName:type = value;

Utah State Flash Card Analogy faceState.text“I’m happy” “I’m sad”

Utah State Variable Types Data typeDefault value Boolean false int0 Number NaN Object null Stringnull uint0 Not declared (equivalent to type annotation * ) undefined All other classes, including user-defined classes. null Adapted from CS3 help file

Utah State Using Variables When to use: Awaiting user input/tracking information You are using values for the same thing in multiple places (kind of a constant). MLK project (example)

Utah State If statements A kind of control structure (conditions/loops)* Something we use every day Flash syntax: if(condition) { // this will run if condition is true. }

Utah State Comparison < Less than > Greater than <= Less than or equal >= Greater than or equal Logical &&Logical AND ||Logical OR !Logical NOT Equality ==Equality ===Strict equality !=Inequality !==Strict inequality

Utah State Examples if(face.currentFrame <= 3) { faceState.text = “I’m sad.”; } /* borrowed with permission from Alan Wayman, 2007—based on an.fla file he adapted and sent via . */

Utah State Can be extended (nesting) rachelSwimLessons = false; if (rachelMood == “brave”) { if (weather != “thunder and lightning”) { if (pool == “open”) { rachelSwimLessons = true; }

Utah State Logical operators rachelSwimLessons = false; if (rachelMood == “brave” && weather != “thunder and lightning” && pool == “open”) { rachelSwimLessons = true; }

Utah State Using else if and else if(face.currentFrame < 4) { faceState.text = “I’m sad.”; } else if (face.currentFrame > 8) { faceState.text = “I’m happy.”; } else { faceState.text = “I’m ok.”; } /* borrowed with permission from Alan Wayman, 2007—based on an.fla file he adapted and sent via . */

Utah State Commenting code Two options: // Best for one line comments /* If you want to have more than one line, then you can use this style for as many lines as you need */

Utah State Debugging Control->Debug Movie Lets you watch variable values (and properties) Two kinds of errors:  Logic  Syntax Other option: trace();

Utah State Don’t forget Library folders Layer folders