RANT: So in school, we have to program using some kind of pseudocode.
Today we wrote an algorithm from a previous exam. Apparently, they don't give you a mark if you get the Array.length(). To receive the mark you have to have to use a variable.
My teacher said it would even be ok to define a variable like Variable = Array.length. THAT MAKES EVEN LESS SENSE

  • 0
    Ouch bro, ouch... What cave do you study in?
  • 3
    @karma the wrong one I guess.
    Good thing, I have to only survive this for a limited time.
  • 2
    It might make sense. Using the length method may be more resource intensive than calling it once, assigning its value to a variable, and using the variable from there on out. Unless that length method returned value is changing along the way, then you may need to use the more resource intensive method.
  • 0
    @funkyboss Yes. That's absolutely correct.
  • 2
    @McTschecker However, I willfully support all rants targeted towards school teachers teaching programming. Most of them suck and don't even know the basics.
  • 1
    @funkyboss in this course they don't care about efficiency, just that it works. However the way they wanted to have it is as we converted a collection to array before, they wanted us to save the counter of elements there and use it in the for loop.
  • 1
    @McTschecker Don't care about efficiency? Yup, sounds like school.
Add Comment