Unit 4- Variables Conditionals, and Functions Flashcards
Expression:
-a combination of operators and values that evaluates to a single value
Alternate Definition:
A programming statement
that can consist of a value, a variable, an operator, or a procedure call that returns a value.
What do expressions always do?
Evaluate/return to a single value!
What symbol is an assignment operator?
=
Assignment operator definition
allows a program to change the value represented by a variable
Arithmetic operator:
part of most programming languages and include addition, subtraction, multiplication,
division, and modulus operators (Which we haven’t learned yet)
Variable:
a named reference to a value that can be used repeatedly throughout a program.
Boolean Value:
a data type that is either true or false.
Comparison Operators:
<, >, <=, >=, ==, != indicate a Boolean expression
Function (Procedure)
a named group of programming instructions.
- Function Call
a command that executes the code within a function
Boolean Expression:
evaluates to either true or false
Concatenation:
joins together two or more strings end-to-end to make a new string.
Conditional Statement:
affect the sequential flow of control by executing different statements based on the value
of a Boolean expression.
Evaluate:
Expressions are evaluated to produce a single value.
Logical operator:
NOT !, AND &&, and OR ||, which evaluate to a Boolean value.
Relational operator:
used to test the relationship between two variables, expressions, or values. A comparison
using a relational operator evaluates to a Boolean value. For example: =, ≠, >, <, ≥, and ≤
-THE SAME AS A COMPARISON OPERATOR
Selection:
determines which parts of an algorithm are executed based on a condition being true or false
String:
an ordered sequence of characters.
What does getText/getNumber do?
Usually used in an onevent, gets input data from a specified UI element
What does a concatenation operator do?
Combines multiple strings into one
What does a \n new line operator do?
creates a new line of text
what is an assignment operator
(=) Gets the value of a variable, and changes the value of a variable in a program
Comparision operator
evaluates whether an expression setting 2 variales equal to each other is true or false (boolean, ==)
What is an if-else statement?
a conditional garunteed exactly 1 of 2 instructions of code will execute
What is an if-statement?
A conditional that will execute its code if and only if the expression is true. otherwise, the entire section of code is skipped.
What is a nested if statement?
AP pseudo code for if- else-if
What does it mean to assign a variable
-giving a variable an initial value using an assignment operator
What also means to assign a variable?
-initializing a variable
What does it mean to declare a variable
-creating a variable ALWAYS using var, which is only used for declaring variables
What also means to declare a variable?
defining a variable
What does calling a variable mean?
-referencing/using a variable in a program statement
What is variable reassignment
Giving a variable a new value after it’s been assigned one.
What happens if a variable is defined/declared in a function
It is local, so it does not leave the function. Therefore, it cannot be used in code, and the function will cause an error, or it will be skipped altogether.