The yield keyword in Python is used in the body of a function like a return statement, but when a function with a yield statement is called, it returns a generator object instead of a single value. The generator can then be iterated over to retrieve the values produced by the yield statement one at […]
January 13, 2023 | python | No comments
A function is a collection of statements that accept input, perform some specific computation, and return output. The idea is to combine some frequently or repeatedly performed tasks into a function so that instead of writing the same code for different inputs, we can call the function. All functions written by the user fall into […]
December 6, 2022 | python | No comments
When encountered, jump statements are used to shift program control from one part of the program to any other part of the program unconditionally. In C++, jump statements are implemented using : continue break return goto continue: Within loops or iterative statements, continue statements are used. The continue statement’s goal is to skip the remaining statements of the current iteration of the loop and proceed to the next iteration. Example: Output: break: The break statement allows us to jump out of the loop instantly, without waiting to […]
September 29, 2022 | C++ | No comments