3rd Algo Class

Selection

An instruction with pre-determined conditions. Depending on the conditions and the type of selection is being used, this may be used for looping.

  • If(-Else): is given a condition and when true then it will run the statement, if false then it will either loop, continue to another condition or run the “false” statement, depending on whether it’s just an If or an If-Else. Ifs can be stacked or “nested” (continue to another condition, as previously stated), which gives more and more If conditions.
  • Switch-Case: like an If but much less space-consuming, as it creates multiple cases which runs different statements. It will run the one that fits the expression, if none of the cases fit with the expression then it will run the default statement.
  • “?:”: similar to if, but values are set without much a hassle. The expression is given, and then you input the statements that will be run if the values are true or false towards the expression.
  • Something about Go To and Label… Didn’t pay attention to this one.

Error Types:

  • Compile-Time Error, caused by a syntax error
  • Link-Time Error, successfully compiles but causes a link error, caused by no object code at link time
  • Run-Time Error, successfully compiles but error at runtime (usually caused by invalid numerical operations)
  • Logical Error, wrong result caused by illogical flow or incorrect algorithm

Leave a Reply

Your email address will not be published. Required fields are marked *