Programming Fundamentals Flashcards
Variable
Named item used to hold a value
Assignment Statement
Assigns a variable with a value
Variable Declaration
Declares a new variable
Specifies variable’s name and type
Expression
Combination of items (variables, literal, operators, parentheses) that evaluates to a value
Identifier
Name created by a programmer for an item (variable or function)
Must be be a sequence of letters, underscores, and digits
Must start with a letter or underscore
Case sensitive
Reserved Word
aka Keyword
Part of the language and cannot be used as an identifier
Camel Case
Capitalize each word (except the first)
Underscore Separated
Lowercase words separated by underscore
Literal
Specific value in code
Operator
Symbol that performs a built-in calculation
Precedence Rules
Order of standard mathematics used in expressions () items within parentheses Logical not unary - negation */ \+- Relational Equality Logical AND Logical OR left-to-right
Unary Minus
Minus (-) used as negative
Incremental Development
Process of writing, compiling, and testing a small amount of code. Then doing another small amount.
Function
List of statements invoked with function’s name
Pseudo-Random
Random number generators have an equation based off a seed
Integer Division
If two integers are used in division the result will be an integer. If at least one operand is floating-point then the answer will be floating-point
Type Conversion
Conversion of one data type to another
Integer to float (25 = 25.0)
Float to integer (4.9 = 4)
Implicit Conversion
Automatic data type conversion
If either operand with arithmetic operator is a float, the other is converted
During assignments, the right side is converted to left side type
Type Cast
Converts a value of one type to another
An integer can be converted to float by multiplying by 1.0
Constant
Named value that should not change during the program’s execution
[]
Brackets
{}
Braces
()
Parentheses
\n
New Line