Tuesday, March 19, 2024 09:21

Posts Tagged ‘functions’

Lambda expressions

Sunday, January 12th, 2020

In the previous lesson I was writing that we can further improve our code by using lambda expressions. A lambda expression is a convenient way of defining an anonymous (unnamed) function that can be passed around as a variable or as a parameter to a method call.… Read more

Generic methods

Friday, June 23rd, 2017

Generic methods, like generic classes, are parameterized (typified) methods, which we use when we cannot specify the type of the method’s parameters. Also like in the case of generic classes, the replacement of unknown types with specific types happens when the method is called.… Read more

Recursive functions

Thursday, April 20th, 2017

Recursion is a mathematical concept that defines any object that is contained or defined by itself. That should be the official, academic definition. In simple words, recursive functions are functions that make a call to themselves from within their own body, in order to solve a problem.… Read more

Best practices when using methods and functions

Wednesday, April 19th, 2017

There are two main reasons why methods and functions are even used. First one, which I already mentioned in a few of the previous posts, is code re-usability. The second is modularization of the code, splitting of complex tasks into smaller sub-tasks, which can offer us a better overview of the entire functionality.… Read more

Return operator

Tuesday, April 18th, 2017

In few of our previous lessons, we used functions – methods that not only can be called, perform some action, but also return a value to the caller – the piece of code that called them. You can imagine this as placing the returned value in the place where the function was invoked from.… Read more

Methods and functions signature

Monday, April 17th, 2017

I talked in the previous lesson about methods and functions signatures, and I offered there a brief explanation on the topic. It is time to explain this new concept in more detail. At a basic level, there are only two things that are mandatory to specify a method or function signature: the parameters type and the order in which the parameters are listed.… Read more

Functions and methods overloading

Monday, April 17th, 2017

There are times when we have functions or methods that perform basically the same thing, but use different kind of parameters. So, in other words, there are cases when we have methods with the same name, but with different signatures.… Read more

Optional parameters

Sunday, April 16th, 2017

When I explained functions and methods parameters, I said that we can use them to send different values that our methods and functions can use in their calculations. You should also know that methods and functions can have optional parameters, parameters with a default value, which can be skipped when calling a method or function.… Read more

Execution workflow

Saturday, April 15th, 2017

Whenever a method executes, it takes control over execution workflow of the program. However, if in the caller method we call yet another method, the execution is transferred to this new method, until it’s code is executed, and when that finishes, the execution control is returned to the first calling method.… Read more

Methods and functions parameters

Tuesday, April 11th, 2017

Our methods and functions can perform different actions, but sometimes, we need to offer them certain relevant data to process. We do this by using methods and functions parameters.

One of the primary goals of methods and functions is what we call code re-usability and this means we don’t have to copy and paste the same piece of code over and over, whenever we need that certain action to be performed.… Read more


Follow the white rabbit