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
answer321
viewsStruct vector: Passage by reference in C
This code is from a simple register of people, containing code and name of the person. I am confused about the passage from the struct vector to the "insert procedure". When compiling, the program…
-
1
votes2
answers226
viewsBuild error in C++ when accessing structure in function
I’m creating a code that holds the information of three people inside one struct, but I am having a build error when I will save the age option on struct. The mistake is this: /home/arthur/Área de…
-
1
votes1
answer31
viewsAsymptotic complexity of function
When I have a function of two variables like: f(x, y) = log y + 3 * x^4 I can say that the asymptotic domain of function is theta(x^4)? Or I have to consider the two variables and define how Omega(y…
-
1
votes1
answer83
viewsPostgresql - Trying a rollback in a function
The structure of relation between tables presented below is not the most convenient and technical. Just to illustrate what I need. I have read many articles about Function, Trigger functions and I…
-
1
votes1
answer94
viewsReferencing OPTION in javascript
Next: I have to enter the name and price and status data, depending on the state it calculates the icms. I wanted to make sure that depending on the OPTION I select it calculated automatically, with…
-
1
votes1
answer44
viewsProblem loading global attributes (date-*) with jQuery
Hi, guys from the O.R. Can you help me with my homework? I’m a beginner in jQuery and I need to solve an "enigma" that my teacher proposed to the class and allowed us to search here on the site.…
-
1
votes2
answers548
viewsUsing two functions in the same Onclick
I have two Javascript functions that are triggered by the same button, one that is responsible for validations and one that moves the page forward. I can not join these functions and nor change the…
-
1
votes2
answers55
viewsHow to change background-color every time the page refreshes? - Javascript
How can I do a function with Javascript that: whenever you refresh the page, change the background-color tag body to one of the default colors? Example: I want to define a 3 different colors, so…
-
1
votes2
answers33
viewsHow can I create update function in colab without restarting its kernel?
I have my functions done outside of colab, in py files, however I would like to change the function and not need to restart the colab kernel. For this function to work in the notebook I am currently…
-
1
votes2
answers40
viewsRelated Posts Wordpress
Fala galera, I am developing a wordpress theme, and on a page I use a function to pick up related posts, it picks up all posts to the current. But he wouldn’t need to take the current one, what…
php wordpress function wordpress-theme wordpress-pluginasked 5 years, 10 months ago José Firmino 43 -
1
votes1
answer170
viewsHow to create a data frame with results from a function
I created a function and would like to create a data frame with results of this function for a few hundred parameters values. I did as in the script below, but as we can see the script will be giant…
-
1
votes1
answer58
viewsIs it possible, in a function, to return the reference to an array index?
The idea is to have a function that receives a array and return the reference to an index of the same, for example: $list = ['a', 'b', 'c', 'd', 'e']; function ref(&list) { return &$list[3]…
-
1
votes2
answers49
viewsRedeem results in r
It is possible to rescue only p-value from a simple linear regression in R? I have the following code: reg<-lm(abscissa~ordenada) summary(reg) the answer is: Call: lm(formula = abscissa ~…
-
1
votes1
answer445
viewsDifficulty creating Function in oracle
I’m trying to create a function in the oracle, but I’m having a hard time creating her return. CREATE OR REPLACE function simple_function( state VARCHAR2, city_id NUMBER) RETURN VARCHAR2 IS ret…
-
1
votes1
answer84
viewsReturn the value that is clicked from an array in a Function. I only know how to do using Event.target
I want to return the value that is clicked, from the array. I know how to do this only with add.Eventlistener. In the case e.target. <h2 onclick="menuclick()" class="notselectable…
-
1
votes1
answer357
viewsCheck existence of Python file with function
I searched all the repositories corresponding to my doubt here, but all are very direct when creating and reading part of files in Python, but I saw nothing related using function. Function to…
-
1
votes1
answer652
viewsPython - Tabuada- For Exercise - Matrix
Good night! I’m trying to create a tabuada program using for and matrix, my code is like this at the moment: def crie_array(rows, columns, value): matriz = [] for i in range(linhas): linha = [] for…
-
1
votes0
answers34
viewsHow to use two buttons in the kivy for the same function?
I can’t get the same function to do two different operations in the kivy: from kivy.app import App from kivy.uix.boxlayout import BoxLayout class Topografia(BoxLayout): def aa(self): a =…
-
1
votes1
answer127
viewsError Read access violation in visual studio function
Good morning, I have a project to do, it is almost done, but now I have created two functions that give me reading access violation error, and I am not able to solve the problem, someone can help?…
-
1
votes2
answers503
viewsCreate function that calculates Java irreducible fraction
I am developing a challenge in Java, and I need to create a function that calculates an irreducible fraction to solve the problem. I created a function from some search but the function does not…
-
1
votes1
answer340
viewsAdd functions in kivy
I’m a beginner in python and in gera programming, I’m doing a project for the school science fair and need help to add this function to my graphical interface (I’m using python 3.6 and I’m on…
-
1
votes4
answers2153
viewsFunction to invert a string
I tried to do a function in order to invert a string but the program always returns (null). #include<stdio.h> #include<stdlib.h> #include<string.h> char reverse(char string[]) {…
-
1
votes2
answers980
viewsFunction that converts dollars to real, Mexican pesos and Chilean pesos
Write a function with the name coinConverter that converts the value of dollars to real, Mexican pesos and Chilean pesos. Use the following exchange rates: reais = dólares * 3.25 // pesosMexicanos =…
-
1
votes1
answer1993
viewshow to resolve Missing 2 required positional argument python
I’m new to Python and programming and I’m trying to create a calculator (interactive way I think kkkk) using the content I’m learning to create functions, but it’s giving this error on the last line…
-
1
votes3
answers184
viewsFunction to duplicate a Python list
Guys I have this list: lista = [['10616558', 0], ['2856466', 1], ['9715350', 2], ['9715350', 3], ['9715350', 4], ['10720706', 5]] The first element is any string, and the second is an index. I need…
-
1
votes1
answer102
viewsHow does the return of functions in C work?
From what I’ve been seeing, every C function needs a comeback, whether I’m right or not? 1- What is the reason for this? It influences something? (I would like a logical explanation if possible). 2-…
-
1
votes0
answers75
viewsHow to divide a program into functions?
How to divide the code into functions in the imperative paradigm? Depends on the type (procedural, modular, OOP)? Is it broad to ask this, even if only for one of these subparadigmas? Is there any…
function software-engineering software-project modularizationasked 5 years, 2 months ago Piovezan 15,850 -
1
votes1
answer53
viewsWhy does the text skip to the bottom line?
Hello! I am doing a dynamic email signature and would like to put some "buttons" and etc. I made one with the function of showing the second number of the company, but when clicking on it the text…
-
1
votes1
answer106
viewsReturn Undefined
The code itself is working, as far as I’m concerned, the problem is that I’m not sure why my function is returning Undefined. It’s a simple function that’s returning what I really want, but I really…
-
1
votes1
answer698
viewsHow to pass matrix as parameter in C?
Hello. In general, I know that to pass an array as a parameter of a function in C, we have to specify the size of its dimensions. But this makes the function less generic. I was thinking of using…
-
1
votes0
answers32
viewsUse variable value as JS parameter
I was doing some tests to train JS with HTML. Then I made a newsletter system, where a newsletter Object has the notes of some subjects, and by a select chose the subject and which bimonth wanted:…
-
1
votes1
answer104
viewsHow to generate javascript functions within while
I am developing a Soundboard, and in this code, each <audio> is generated by record found in the database, and each of them has a volume controller, however, all controllers only work pro last…
-
1
votes0
answers58
viewsHow to dynamically define the function to be called in Python
Hello, I would like the program user to write a function for later use, however I’m having difficulty to implement this: See the example below: def funcao_integracao(x): y=x**2 return y def…
-
1
votes1
answer26
viewsMocking function returning several times
Context: It’s the first time I’ve tried to implement a function debounce() in Javascript and I think I’m forgetting or getting something wrong, because she is making several calls in the API,…
-
1
votes2
answers50
viewsError in python3 function
I made this function where will be assigned a name and a value, which enter a while loop repeating 5 times, each time the loop repeats the values will be assigned to a different list, finally it…
-
1
votes2
answers113
viewsEncapsulation of functions
Below is an example of using a function passed as a parameter to another function: def gera_nums(): lista = [] for c in range(0, randint(1, 15)): lista.append(randint(0, 100)) return lista def…
-
1
votes1
answer511
viewsI cannot increment a global variable in function parameter
What was asked of me: Declare a global variable called counter and assign it 0. Declare a Function called incrementCounterBy, which receives a Parameter called amount. It should increment counter by…
-
1
votes1
answer67
viewsWhat’s wrong with this array of pointers in C? (incompatibility?)
Hello, recently I was doing a relatively simple test to try to unify some concepts I have been studying, and which you will see below. It is an array of pointers that I used as a parameter of a…
-
1
votes1
answer56
viewsHow to call a function within function?
I’m developing a API, and in it I need to implement a method that seeks within my database a film through your ID. As I will use this method to perform more than one time, I would like to reuse it…
-
1
votes1
answer80
viewsHow to pass values from one function to another?
I made the code below, in order to receive and display data, as if they were related to a tax bill. The code displays the following error when running: File "main.py", line 49, in <module>…
-
1
votes2
answers71
viewsHow to prevent a function from being executed when a condition is reached and reactivate it when necessary?
I’m in a skirmish here to try to stop a function when a certain condition is reached and rehabilitate it if a certain button is clicked. In my case, I have a text and buttons that change the font…
-
1
votes0
answers237
viewsUsing the "as Numeric" function in Rstudio
Hello! I am trying to create a new binary variable to an existing database using the following code: leaders$warbefore <- as.numeric(leaders$interwarbefore == '1', leaders$civilwarbefore == '1')…
-
1
votes1
answer53
viewsR - How to generalize a function if data is missing.frame
I created the function below to calculate the descriptive statistics of certain companies separated between the 5 regions of Brazil and the total and present in a table. library(tidyverse)…
-
1
votes1
answer298
viewsHow to return a tuple to a function in Haskell?
I started messing with Haskell because of some college activity, and I’m having doubts about what the error in my code might be. The program will have two functions. 'tam', which will return the…
-
1
votes1
answer60
viewsParameter of a function
How the code ran right if the function parameter experiencia does not have the same variable name anosEstudo. How Javascript understands that they are the same thing? <script> var anosEstudo =…
-
1
votes2
answers322
viewsWhy the function returns the Undefined value
I am trying to check whether an item within the array is divisible or not by another number passed as a function parameter. When an item is divisible returns that same item. If not, it returns "No…
-
1
votes1
answer87
viewsHow can I decrease the level of complexity of this function?
I’m learning development Web with HTML, CSS and Javascript and I came across the problem of generating a phone number with parentheses, dash and space. As I’m starting I developed a code that…
javascript function code-review number-formatasked 4 years, 2 months ago Rogério Rodrigues Sousa 19 -
1
votes1
answer56
viewsProblem to add data to a dictionary
I’m trying to build a function for calculating multi-note averages, but error occurs when I try to pass this data to a dictionary. The system claims that the class of data that I try to pass is not…
-
1
votes0
answers27
viewsCalling function NODEJS returns 400
I have a REST method that calls a Function. This Function checks if a vaccine already exists in the database, otherwise creates and returns to the method that called it. However, when calling the…
-
1
votes1
answer20
viewsWhy declare the timeout ID outside the callback of the mocking function?
This is a function that prints in the console what I type in the input. I would like to understand why, when I declare the ID of the setTimeout (in that case called time) outside the function, it…