Most voted "function" questions
The function (also called procedure, method, subprogram, or routine) is a portion of code intended to perform a single, specific task.
Learn more…1,309 questions
Sort by count of
-
1
votes1
answer415
viewsMultiple pass to simple parameter in Postgresql
I created a function in Postgresql where I sum certain accounts. However, my function has only one parameter for them: f_retorna_somatorio(p_conta character varying, p_cnpj character varying,…
-
1
votes1
answer36
viewsHow to handle function calls in php
I have with problem related functions in php, Basically the user can try to access a function inside php dynamically, if the function exite it is executed, more if it does not succeed it returns…
-
1
votes2
answers2357
viewsHow to call two functions in onClick (Reactjs)?
Here are my two functions, chamaLogin = () => { this.setState({ redirect: true }); }; ----------------------------------------------------------------------------- handleSubmit = event => {…
-
1
votes1
answer421
viewsCallback as return of argument
My question is this, from what I understand callbacks are functions passed as parameter that will be executed when some instruction is performed, but I often see the callback as a reserved word to…
-
1
votes1
answer93
viewsHow to call a function within another function?
I’m doing an activity, and the activity asks to call a function within another function, how can I do that? 2.10 Write a function that returns the value of a high number to the fourth power. This…
-
1
votes1
answer143
viewsI cannot return assigned values to variables
I am layman programming myself and decided to start a program in python to use as a tool in a game well, the code so far is this: def tempo (temp): total=temp*quant dias=total//(24*60*60)…
-
1
votes1
answer3065
viewsJavascript Discount
I made a Javascript to calculate discounts of a certain value, but I think it is not calculating the percentage correctly. If anyone can help me, I’d appreciate it! Paying in debt person gets 25%…
-
1
votes1
answer383
viewsPython - What is Enum?
I used the type function on an object and the returned was: <enum 'Button'>. What does that mean?
-
1
votes1
answer86
viewsHow does this function work?
It’s part of an sorting algorithm, reading the code made it seem to me that the function never makes the call: sort(mid+1, high); gets into loop at first sort(low, mid); until you leave the if, and…
-
1
votes1
answer657
viewsreturn function json object
i have an android function that connects to the server and returns me a json, that json and stored in a variable called object. however I have to make this object go to another screen via Return but…
-
1
votes1
answer147
viewsHow to call class method within the thread?
How do I call a class method inside a thread? I have a very simple thread and a class method. How do I call it inside the thread. As it is in the code below the compiler gives error #include…
-
1
votes1
answer72
viewsSE function with 3 final values
---Rephrasing the question--- A formula expressing the following information: -When Column I and J is written "Letter N" will return in column C the writing "PSI" -When Column K and L is written…
-
1
votes2
answers328
viewsParameters in Javascript functions
What are the parameters in the functions and what are their needs? I don’t understand the difference between having or not having a parameter in the function, for example Parameter-less: var V =…
-
1
votes1
answer45
viewsAsync request problem with variables
The problem is with variables why the function async is running after the variable assignment. what can I do for the function to run and wait for it to finish to take the variable value? var request…
-
1
votes1
answer112
viewsHow to avoid repeating commands through a function?
I am creating a program to do some math math with some commands and has 1 line of code that repeats in all conditions, with only a small change in each of the conditions. My question is how to…
-
1
votes1
answer72
viewsHow to check if the function would generate an Exit in C++
I have a .lib with some functions. I defined that when the calculation of some function generates values outside the range allowed it to exit(). Now my C++ code that uses this lib need to calculate…
-
1
votes1
answer143
viewsVariable changes value when calling function
I created a variable v, who receives n random numbers. when create another variable by calling a function and passing v by parameter, the v mute. n = int(input("Entre com o tamanho de vetor: ")) v =…
-
1
votes0
answers493
viewsHow to know how many times a function has been executed?
Is there any way to know how many times the following function has been executed Ps: this function is clicked on the element. function popBaloon (object) { object.setAttribute("class",…
-
1
votes1
answer66
viewsHow to change the value of an entire argument passed as a reference in Julia
function muda_o_valor_do_inteiro!(x::Int64) x = 10 end a = 9 muda_o_valor_do_inteiro!(a) println(a) # a deveria possuir o valor 10 I have already understood that with vectors I can modify the value…
-
1
votes2
answers107
viewsHow does a function know how to take the elements of an array if they are not being passed to the function?
Hello, the following code is correct, but I would like to understand one thing: const Carros = ['Mercedes', 'Ferrari', 'BMW'] function imprimir(nome, indice){ console.log(`${indice + 1}. ${nome}`) }…
-
1
votes1
answer508
viewsJAVA POO - How to call a function from a Class
So I have the following problem , I created a 30x60 matrix in which I will generate a number in a random position, so far so good. But when I took the function that generates the number and put it…
-
1
votes2
answers77
viewsReturn pieces of an eternal
Implement a generator function, chunker, which takes an iterable and returns a specific piece of size at a time. Resorting to the function like this: for chunk in chunker(range(25), 4):…
-
1
votes2
answers126
viewsI want to search by name of any function from a search field
Guys... how can I make a system in which the input text gets a name from function.. then he searches his name internally with the name that is on string. guy... In HTML I do the following: <input…
-
1
votes2
answers130
viewsResult Undefined when calling function in calculator
This script for calculation but it returns undefined, where I’m going wrong? var num1 = parseInt(prompt("Digite um número: ")) var operacao = prompt("Digite a operação: ") var num2 =…
-
1
votes1
answer211
viewsPointer Statement in a struct and calling it in function
I must solve the following problem by creating a function for reading, one for calculation and using pointers. #include <stdio.h> #include <stdlib.h> #include <math.h> struct ponto…
-
1
votes3
answers124
viewsHow can a pointer point to a function?
A pointer points to a memory address, so how a pointer is able to point to a function? If the answer is "functions also have addresses" then please give more details. And if it is possible to…
-
1
votes1
answer65
viewsPrintar value of a struct by pointers
I want to print the "attribute" name of a "Person" type struct, but the printf returns (null) but I declare the struct name. Follow the code below: typedef struct pessoa{ char *nome; struct pessoa…
-
1
votes2
answers152
viewsCan anyone explain to me how this code works?
I can’t understand the use of prototype.allReplace nor the use of RegExp. What are these parameters? String.prototype.allReplace = function(obj) { var retStr = this; for (var x in obj) { retStr =…
-
1
votes2
answers183
viewsInstantiated object does not appear in function
Hello, I am creating a Java project using Eclipse with windowbuilder. Inside this project I have Jframe with the objects, jbuttons, jtextfields, jformattedtextfields, etc... I have all these objects…
-
1
votes2
answers86
viewsHow would you solve this simple question?
I was solving a simple Python question The program asks for three numbers and returns in descending order - I decided to do it using a list, like this: numeros = [] for i in range(0,3):…
-
1
votes1
answer61
viewsHow do I stop an array through a function?
I am writing a code in Unity you need to pass several values through a function, I decided to use the array in the function statement, however when I try to recover the values of the array all of…
-
1
votes1
answer728
views -
1
votes2
answers65
viewsHow to use the filter function using lists?
I am trying to filter the months with only 31 days, however mdays is a list and I need to compare with an integer value. Taking the Dice, it becomes an integer value, but then I don’t know how to…
-
1
votes1
answer249
viewsUsing a PHP class without instantiating it into a variable is the same thing as calling a function?
Declare the class this way without instantiating it into a variable: new ExampleNameClass( 'arg1', 'arg2' ); It would be the same as wearing a function? ExampleFunction('arg1', 'arg2'); Since I did…
-
1
votes1
answer339
viewsCheck if the number typed is already present on the struc
Good afternoon, I’m facing the following problem. I need to make an algorithm for registering bank accounts of 15 people with the following information: account number, name and balance. However it…
-
1
votes1
answer68
viewsWhy am I getting the "0" return regardless of the entered input?
#include <stdio.h> int Comparacao(int x, int y){ int resultado; if(x < y){ resultado = -1; }else{ if(x == y){ resultado = 0; }else{ …
-
1
votes1
answer111
viewsReuse a function
Can someone help me in how I reuse the functions to simplify the code and make it cleaner ? function bonusPL(){ var bonusPL = document.getElementById("bonusPL");// seleciona o elemento pai var…
-
1
votes1
answer40
viewsPass parameters to a function being passed from parameter to parameter
Imagine this, I have the function 1 that needs to receive as a parameter a function callback. Function 2 needs to receive a parameter and I need to pass it as a function value1, as I would pass this…
-
1
votes1
answer861
viewsPassing array as a function parameter
How to pass a array to a function without me having to inform the amount of indexes it has? Stating the size #include "stdafx.h" #include <Windows.h> void imprimir(int _array[], int _tamanho)…
-
1
votes1
answer37
viewsCreate loop and move to arguments of a function?
I have the following code in Python: storage.tableWidget.setColumnWidth(0, 30) storage.tableWidget.setColumnWidth(1, 140) storage.tableWidget.setColumnWidth(2, 90)…
-
1
votes3
answers67
viewsTake the url and change the value?
Site node have a function to sort higher and lower value. I need to take the current url and change a value that is within it. Current URL: http://localhost/search.php?…
-
1
votes1
answer89
viewsHow does an asynchronous method behave when executing a synchronous Python method?
In Python an asynchronous method is able to run in parallel, but if within it I have a "normal" function, it will also be run asynchronously or from that moment the execution will be "locked" and…
-
1
votes1
answer50
viewsCalculate items from a table
I need to calculate table items and show in a given field of my page. Currently it is like this: <div class="pacientes"> <div class="pacientes-header"> <i class="fa…
-
1
votes0
answers45
viewsEvent to calculate searched items in the table
I need to calculate table items and show in a given field of my page. There is a search field with some filters, as it is researched appear the patients in the table, with the event I wanted to hear…
-
1
votes1
answer69
viewsThe function returns Undefined. What’s wrong?
var pulaLinha = function() { document.write("<br>"); } var mostra = function(frase) { document.write(frase); …
-
1
votes0
answers99
viewshow does a function "const void *foo( param, param) work"?
bool cmp(const void * a, const void * b) { return static_cast < /*type?*/ * > a < static_cast < /*type?*/ * > b; } const void * min(const void * first, const void * last, size_t size,…
-
1
votes2
answers83
viewsWhy do we use parameters/arguments in functions?
If a function can see environment variables, that is, it can see variables defined in the main program. Why we pass parameters and arguments to this function? In the example below, I wrote an…
-
1
votes0
answers36
viewsArray of pointers that point Functions
Good afternoon. I wonder if the code below is correct. I have a little bit of pointer difficulty and I entered this area of pointers to functions and I would like to understand more about this…
-
1
votes1
answer41
viewsOptimization of php code (NF key generation)
Dear colleagues, currently I am working on a project that carries out the sending of tax coupons, in it I arrived at a function that generates the key of the nfe, in it I receive the following data:…
-
1
votes1
answer76
viewsJavascript converts string to int when passed as function parameter
I have the following excerpt: "onclick=relatorio("+dados[i].cnpj+")" data[i]. cnpj is a String type variable, or at least need it to be so, but Javascript converts the function parameter into a type…