Tag: variable
How to pass variable arguments in a function
In this article we will discuss how to pass variable number of arguments in a function. Requirement: Advertisements Suppose I want to create a function that take variable number of arguments and use them to perform some task. For example, Create a function that will return the sum of all the passed arguments i.e. Frequently …
Passing Variable Arguments to a function in Java using varargs – Tutorial & Example
In this article we will discuss how to pass variable number of arguments of a type in a function in java using varargs. Passing Variable Arguments to a function Let’s write a function that accepts variable number of same type for example int in this case i.e. Advertisements Calling function with 2 arguments i.e. two …
Passing Variable Arguments to a function in Java using varargs – Tutorial & ExampleRead More
C++11 : How to use std::thread as a member variable in class ?
In this article we will discuss how to use std::thread object as member variable inside class and its benefits. As std::thread objects are move only, therefore while designing a class that use std::thread as member variable, we need to take care that objects of this class should also be move only. Advertisements Creating Move-only class with …
C++11 : How to use std::thread as a member variable in class ?Read More
Python : **kwargs | Functions that accept variable length key value pair as arguments
In this article we will discuss how to create functions in Python that can accept variable length arguments in key value pair format. Suppose we want to define a function that will print the provided students details. Details will be in key value pairs, where key represents the property name and value as property’s value. …
Python : **kwargs | Functions that accept variable length key value pair as argumentsRead More
Check if type of a variable is string in Python (3 Ways)
In this article we will discuss three different ways to check if the type of a variable is string or not in python. Check if type of a variable is string in python using isinstance() function Python provides a function to check the type of a variable i.e. Advertisements isinstance(object, classinfo) This function returns True …
Check if type of a variable is string in Python (3 Ways)Read More
How to put a variable inside a string in Python?
In this article, we will learn to put variable’s value inside a string using Python Programming language. This can be very helpful where a statement is same but some value we get from an any other source like API changes daily. In that scenario we need to figure out a way to put the value …
Print a variable & string on the same line in Python
In this Python tutorial, you will learn how to print a variable and string on the same line. Table Of Contents Print a variable and string on the same line using the comma operator Print a variable and string on the same line using %d and %s Print a variable and string on the same …
Print a variable & string on the same line in PythonRead More
When to wrap quotes around a shell variable in Linux?
Most of the programmers who are new to shell scripting and dealing with string variables, have a doubt regarding when they have to wrapquotes around a shell variable. In this article, we are going to perform some tests and try to understand when and where quotes around ashell variable are required. Table of Contents List …
When to wrap quotes around a shell variable in Linux?Read More