varsity college 3

Basic Concepts of Naming and Formatting

  • Variable Naming Conventions:

    • Must start with a letter.

    • Use camel casing for variable names (e.g., movieTitle).

    • First word is lowercase; subsequent words start with uppercase letters.

  • Example of Camel Case:

    • Movie title: words separated by a capital letter at the start of additional words.

Correctness of Statements

  • Evaluating Naming:

    • Correctness assessed based on naming effectiveness and clarity.

  • Importance of Meaningful Information:

    • Names should convey what data represents.

Types of Casing

  • Overview of Casing Styles:

    • Camel case: used for variable names.

    • Other casing types mentioned: Castile, Hungarian, etc.

Mathematical Expressions

  • Operator Placement Rules:

    • Operand must not be to the left of the assignment operator; it should represent a memory address.

    • Standard arithmetic operators: addition (+), subtraction (-), multiplication (*), and division (/).

    • Operations must start with variables before assignment operators.

Order of Operations (Precedence)

  • Basic Order Rules:

    • Parentheses evaluated first.

    • Multiplication and division evaluated next, followed by addition and subtraction (left to right).

  • Example Breakdown:

    • For operation handling mathematical expressions, the order determines outcome effectively.

Mathematical Operators Categories

  • Three key categories to remember:

    1. Arithmetic Operators: Basic mathematical operations.

    2. Relational Operators: Used for making comparisons or program decisions.

    3. Logical Operators: Connect relational expressions.

Logical Operators Explained

  • AND Operator:

    • Returns true only if both operands are true; otherwise, false.

    • Example: x > 2 AND x < 5 must satisfy both conditions.

  • OR Operator:

    • Returns true if at least one of the conditions is true.

  • NOT Operator:

    • Negates the operand; returns true if original operand is false and vice versa.

Variable Naming Practice

  • Variables associated with data types:

    • Name of vendor company: Data type = String.

    • Example variable name could be vendorCompanyName.

    • Always employ camel casing in naming variables.
      - Questions for Practice:

    • Determine data types for various examples, enhancing comprehension of variable naming and associated data structures.

Conclusion

  • Key takeaways from variable naming and mathematical operation principles:

    • Use naming that reflects data intent and maintain proper casing for clarity.

    • Understand operator precedence to formulate clear and effective expressions.

robot