In this session, we will be discussing Algorithm, Forward & Backward incrementation.
First of all, what is an algorithm?
I could remember my first algorithm course in the university, my java lecturer asked the student to create a paper plane. Then she asked us how we emerged to making such similar planes?, then everyone started narrating in different ways. She then replied and said an algorithm mustn't be written in the same pattern but often results in the same result.
An algorithm is a way or pattern you use in solving programmatic issues with consideration of time and space complexity.
So now haven explained algorithm, what is ++(incrementation)?
++ simply means incrementation by 1, it's similar to +1 but +1 is not effective and adviseable.
Forward incrementation is a simultaneous way of incrementing a value by 1. In this type of incrementation, the value immediately changes(with the addition of 1). But in the case of backward incrementation(counter++), the value gets incremented at the background but only gets it added when you use it a line after the line it was incremented.
let prefixIncrementer = 0; ++prefixIncrementer;//1
Backward incrementation is a way of incrementing a value that takes effect only when you invoke it a line after it was created.
let backwardIncrementer = 0; backwardIncrementer++;//0 backwardIncrementer;//1