UNIT 4 Flashcards
covers everything that was taught in U4
U4L1 Evaluate
+
U4L1 Can you use the / operator to concatenate?
No, only the + operator to concatenate.
U4 L10
What will the statement show after running the code?
KEEP IN MIND: var changes at top of screen, which of the two are displayed?
It will display “School day”
sat -> mon, mon != sat or sun so “else”, “else”=weekday, weekday= SD
U4 L8
What part of the code do you use flowcharts for?
if else statements
U4 L8
STATEMENTS
what does the “if” statement do?
specifies a block of code
U4 L8
STATEMENTS
what does the “else” statement do?
if the same condition is false, it specifies the execution for a block of code
U4 L8
STATEMENTS
what does the “else if” statement do?
tests if the first condition is false
U4L2
how do “getText” and “getNumber” work?
grabs the text/number from the chosen line of code
getText (“locationDropdown”) ;
= gets text from locationDropdown
U4L3
how many times do you have to create variables and why?
once, can cause errors
U4L3
where should you keep your variables and why?
at the top of the program to stay organized
U4L3
should your variables be created inside or outside a function or onEvent?
outside
U4L11
if I want the screen to update as I type, in stead of “onEvent(“downButton”, “click”, function( ) {“ what should I write?
onEvent(“downButton”, “change”, function( ) {
U4L2
how do I get a users name input to show on the screen output
(ex: they’d type “Jassy” and Jassy would be shown somewhere on screen)
getText, (ex:
userName = “Hi, “ + getText(“nameInput”)+”!”;
)
U4L2
how do I get a value of a variable to increase or decrease? (ex: value goes up or down)
math (+-)
( ex: tempF = tempF + 1; )
U4L2
which programs should comments be used in and why?
every program, helps the debugging process
U4L4
where should comments be used, placed, and what should they include?
should be used above every onEvent, function, starting variables, and include purpose & purpose
U4L4
what does “\n” do?
creates a new line of output
U4L5
what does a flowchart do?
visualizes an if-else statement before using it
U4L5
true or false, “ 6+3 == 3+4” ?
false
U4L6
can an expression deal with a “maybe” answer
yes, develop a range (ex: 1) yes 2) sometimes 3) no)
U4L6
how do u evaluate a percentage?
long division
U4L6
what does the following if-else statement mean?
“if (score > 15){
setProperty(“lemon”,”width”,60);
setProperty(“lemon”,”height”,60);
} else if (score > 10) {
setProperty(“lemon”,”width”, 100);
setProperty(“lemon”,”height”, 100);
} else {
setProperty(“lemon”,”width”, 140);
setProperty(“lemon”,”height”, 140);
}”
if the score is greater than 15 the lemon is set at 60 w&h
if the score is greater than 10 the lemon will increase in size by +40
if-else (is greater than 15) the lemon will increase in size by +40 once again
U4L7
what code is used to get a screen to change when a button is clicked
onEvent and setScreen
U4L8
if I wanted to make a discountCode on something that cost $$$ what should I do?
create if-else statement, some kind of math code, and set the price to discount
ex: price=0