1/16
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Expression:
a combination of operators and values that evaluates to a single value
Variable
holds one value at a time. A reference to a value (or value that results from evaluating an expression) that can be used repeatedly throughout a program
Creating variables
Create them once (use var once)
Put them at the top
Create outside functions or onEvents
Global vs. Local Variables:
Global
Permanent. Can be used anywhere in your code (var is outside onEvent)
Local
Temporary. Can be used only in the part of the code where it was created, deleted once code is done running (var inside onEvent)
Assignment Operator:
allows a program to change the value represented by a variable (<-- or =)
Debugging
The process of finding and fixing problems in a code
Describe the problem
What do you expect it to do?
What does it actually do?
Does it always happen?
Hunt for bugs
Are there any warnings or errors?
What did you change most recently?
Try solutions
Make a small change
Document as you go
What have you learned?
What strategies did you use?
What questions do you have?
Error Types:
Syntax Error
Your code doesn’t follow the rules of the programming language
Name not in quotes, using variable that doesn’t exist…
Logical Error
Your code follows the rules of the programming language but doesn’t do what you intend
If-else statements in wrong order, updating wrong property…
Information can be stored as…
Numbers (no quotes)
Strings (quotes)
Boolean Expression:
evaluates to true or false
Boolean Value
True or false
Comparison Operators:
<, >, ==, <=, >=, !=
Logical Operators
&&, ||, !
Operator
+, -, x, /
Truth Tables
&& (and)
True && True = True
True && False = False
False && True = False
False && False = False
|| (or)
True || True = True
True || False = True
False || True = True
False || False = False
! (not)
! True = False
! False = True
onEvent
used when “when” is used. When the user does something
Conditional Statement:
used if “if” is used. Happens if a boolean expression evaluates to true
Function
a named group of programming instructions. Also referred as a procedure
Function updateButton( ) { →
setProperty(
setProperty(
setProperty(
}
Function Call:
a command that executes the code within a function
updateButton( ); →