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
-
0
votes3
answers62
viewsHow to use a button along with a function?(Javascript/HTML)
Hi, I’m writing a page with a Paper Stone or Scissors game. And I would like the user to be able to choose between the three options through three buttons, which when clicked call a function that…
-
0
votes0
answers91
viewsDisable Onclick button that loads Disqus comments
So my theme has this "onClick" button with "comments" as its title. It serves to click and load my comments from Disqus, just below the post. The problem is: it gives error several times, showing…
-
0
votes1
answer449
viewsPHP function for checking information in the database
Hello, I need to check the fomulário register, if the name of the user that was passed already exists in the database. I would like the help of how to make a Function in PHP or javascript that makes…
-
0
votes1
answer92
viewsHow to return the redirect URL with js?
I have a URL that redirects to another URL where the Location with the final URL, I want to return in a var urlfinal only the final URL that is on this Location, and not the URL that is directing…
-
0
votes1
answer147
viewsProblem with a javascript function
I’m trying to make a function to calculate IMC, but when I try to run it gives an error: "Uncaught Referenceerror: imcDoPrimo is not defined at" var mostrar = function(frases) {…
-
0
votes2
answers239
viewsSelect only a part of the Dataframe title
Imagine the following situation, I have a Dataframe with any name. Within this Dataframe I have columns with the following titles More(abc), Less(abc), Sub(abc), following the data of each column.…
-
0
votes2
answers431
viewsIncrease by 2 when activating Function
Hello, I’m a beginner in javascript and I would like to know how to block the item, when var total reaches the same value as the item, ex: 200, increase 2 by 2 not 1 by 1. var total = 1; function…
-
0
votes1
answer54
viewsDimension of a vector passed by reference language C
I would like to know how I discover the amount of positions that have a vector that has been passed by reference to the function, using the language C. Example (Function prototype): int Soma (int…
-
0
votes1
answer203
viewsReact Native only works with 2 clicks
In this code, the function only works after being called twice. ubernehmen = () => { this.setState({wert: ((this.state.cor*208)+(this.state.letra*8)}) this.setState({werta:…
-
0
votes1
answer150
viewsReduce function in controller
I wonder if you have how to rewrite the function below in a cleaner way without so many if / elseif. public function pesquisa(Request $request) { if (! Gate::allows('celular')) { return abort(401);…
-
0
votes1
answer156
viewsHow to pass, by reference, a vector of structures to a function?
I’m having great difficulty understanding the reference passage of a structure vector. No running error happening, but not sure if I am reading the file correctly there. #include <stdio.h>…
-
0
votes1
answer39
viewsIncrement value in a function name
Good afternoon, you guys! Next, I have three file fields in a table of my database, are they: File1, File2 and File3. I also have a get and a set for each of them. The point is, I wanted to run a…
-
0
votes2
answers139
viewsSet functions for equal values and values in ascending order - Python
Hello, I set a function to read 100 records, containing name, gender and age, and now I need a separate function to show on the screen how many people are male and another separate function to show…
-
0
votes1
answer51
viewsHow to delete a character in Python
I’m starting a study with data analysis, but I still don’t know how to delete characters import re import panda as pd df.rename (columns = ("nome_motorista***************": "nome_motorista")) that…
-
0
votes1
answer31
viewsHow to put a Function Arrow in on onclik
How do I place an Arrow function in an onClik since it is named after the variable? The following is an example of:…
-
0
votes0
answers19
viewsError with multiple IF conditions
The if only proceeds if it’s’m' the person’s sex, if it’s the others with || that I put will not, can anyone take away this doubt? char sexo; float altura, pesoideal; printf("Qual o sexo da pessoa?…
-
0
votes1
answer37
viewsMatlab: how to write a function that takes a number n and returns P = 1*1.2*1.4*.... *(1+0.2*(n-1))
How could you create a function called repeat_prod(n) that takes a number n and returns this function P = 1*1.2*1.4*....(1+0.2(n-1)) I’m having a hard time understanding how this function should be…
-
0
votes1
answer59
viewsMaking a button read the functions
I am beginner in programming and I need help with the function of a button, I do not know how to make this button "read" the age values, the idea of the site is to enter the information to see if…
-
0
votes1
answer44
viewsHow to look for a value within an arrangement
I need to write a function that gives me a list of the name skills in the console input.log ms can’t understand this for-of. I’m a beginner in javascript and since yesterday I’m jumping from article…
-
0
votes1
answer85
viewsIs the PHP password_hash function a wrapper for the crypt function?
The function password_hash seems to me a wrapper that adds a high-level layer in function crypt, because it brings a default setting that could be made with crypt manually. Same with the function…
php function security-guard characteristic-language passwordasked 6 years, 4 months ago raphael 2,131 -
0
votes1
answer109
viewsGood practice in C on the "main()" call?
I’m developing a simple app for college work, and I have doubts about using the function main() in the code for instead of going out back to the beginning of the program, this would be good practice…
-
0
votes0
answers91
viewsProblem with the if-lse
I’m having a problem at the time of a comparison with the if-lse! I have a function that reads one file and writes to another only what is approved by if-Else, then deletes the first file and…
-
0
votes1
answer60
viewsFunction to import file. py?
Good afternoon, I created a file called test.py with code that fetches information from a database and turns it into a Dataframe. I’m having trouble creating a function and import this file, follow…
-
0
votes1
answer61
viewsList BLOG and show on the same page the chosen ARTICLE
I am working with PHP and use friendly URL. By clicking on the link <a class="nav-link" href="<?php echo URL::getBase(); ?>blog" tabindex="12">blog</a>, my URL gets:…
-
0
votes1
answer615
viewsMean between vectors within functions (python)
Good afternoon guys, I have the following code: def Ler_vetor(): VET= []*10 for i in range(0,10): VET.append(int(input('Digite um número: '))) return VET def Escreva_vetor(VET): print('Dentro do…
-
0
votes0
answers36
viewsFunction that returns multiple elements
I have a doubt in the following exercise: Make a subroutine that takes a single value representing seconds. This subroutine should convert it to hours, minutes and seconds. All variables should be…
-
0
votes0
answers489
viewsFunction to multiply each row of a matrix by the value of its corresponding secondary diagonal
I’m not getting the values of the secondary diagonal of a matrix by a function. /* 19) Elabore uma sub-rotina que receba como parâmetro uma matriz A(6,6) e multiplique cada linha pelo elemento da…
-
0
votes1
answer170
viewsCall PHP function via Link using MVC
I’m having Difficulty/Problem requesting a function in PHP: The function below is located in a class inside the Folder lib. Language.php <?php namespace app\lib; class Language { public function…
-
0
votes1
answer103
viewsWhy in Python are there functions where the parameter should be placed between parentheses and others should be placed with a dot and the function name?
There are functions that should be written as for example sorted(variavel) and others are written as variavel.sort() I know the differences between the two functions above, I just used to exemplify.…
-
0
votes1
answer95
viewsHow I create an optional parameter
How can I set the second "&& bonus2" parameter as optional ? I want the ways to run if: (bonus1 && bonus2 == true) or (bonus1 == true) It needs to be a parameter that if I put it in…
-
0
votes2
answers217
viewsUse of chained static functions
I wanted to use static PHP functions as follows: class A { static function a1() { echo "A1"; return A; } static function a2() { echo "A2"; return A; } } A::a1()::a2(); Works, but shows this error:…
-
0
votes0
answers184
viewsProblems running Mysql function using Delphi Firedac 10.1
In a Mysql database I have a function (not Procedure) fully functional, I can access normally within heidisql. At Delphi, I’ll tell you what function ExecutarFuncaoSQL(sFuncao: string; aParams:…
-
0
votes2
answers195
viewsRecursiveness using Python
I am trying to create a recursive function that takes a positive integer number N and prints all even numbers from 0 to N in ascending order. I’m only managing to do the opposite, that is, print the…
-
0
votes1
answer84
viewshow to create a function that checks if two lists are equal without using the operator (==)?
iguais:: [Int]->[Int]->Bool iguais [] [] = True iguais [] _ = False iguais _ [] = False iguais (x:xs) (z:zs) this is the code, I only did so far. Someone can help me?…
-
0
votes1
answer46
viewsFile function in C++
Hello I have a problem using the file function, I need to make a program that registers the place and the name of the person in a bus but the problem is that every time I close the program and open…
-
0
votes2
answers46
viewsPrint a new vector by changing the order of the elements of the original vector
How do I change the order of the elements of a vector v1 printing a new vector v2 with these changes? You can write a function def? Example: v1 = [2,51,68,10] v2 = [10,2,51,68]…
-
0
votes1
answer74
viewsArray key filled with an expression coming from an SQL query
What exactly does that mean? Array ( [0] => Array ( [MAX(nr_ficha)] => 13 ) ) I gave one print on the screen and saw that my foreign key (nr_ficha) is receiving value 13 (which yes, is the…
-
0
votes2
answers46
viewsImplementation of member functions
It was overloading operators and defining them within the class itself, I found it natural to do so for these functions, but then a small doubt arose. Is it wrong to define member functions within…
-
0
votes2
answers295
viewsWhat’s the difference between using Return and print in this recursive function that calculates the sum of numbers?
I made a simple function in Python to give me the sum of the numbers n until 0: def retorna(n, zero, soma): if n <= zero: soma += n return soma retorna(n+1, zero, soma) ret = retorna(1, 5, 0)…
-
0
votes2
answers165
views -
0
votes1
answer30
viewsDisplay get_user_role and get_author_role function in English
I’m developing a Wordpress application that uses the function get_author_role, however I am unable to make her appear in Portuguese. The first function modifies the default names: function…
-
0
votes1
answer240
views'function name_name': identifier not found
void inserePoli1(poli **topo1, int val, int expo) { polinomio1 *novo; char cmd; novo = new poli; novo->valor = val; novo->expoente = expo; if (*topo1 == NULL) { novo->prox = NULL; *topo1 =…
-
0
votes1
answer29
viewsFunctions defined within conditional blocks
I am studying PHP and reading the documentation I came across this example: <?php $makefoo = true; /* Nos nao podemos chamar foo() daqui porque ela ainda não existe, mas nos podemos chamar bar()…
-
0
votes0
answers16
views -
0
votes0
answers103
viewsDoubt program that copies from one file to another in C with functions
I have to do a C job that copies one file to another at release time (on linux using argc and argv). I’m not used to file manipulation, but here’s the code and it’s not working, what can I do to…
-
0
votes2
answers42
viewsIf a function is too long, is it recommended to divide it into smaller ones?
I have the following function, which I intend to extend: def get_dataframe(site, search): if site == 'pichau': try: soup = get_page(f'https://www.pchau.com.br/catalogsearch/result/?q={search}')…
-
0
votes1
answer24
viewsAzure Webapp VS Azure Function
What are the biggest differences between webapp and Function? At first, I know that webapp supports higher amounts of data than funtion, and that Function has other forms of activation like Queue,…
-
0
votes1
answer528
viewsCalling a Python function that is already running
I have the following scenario. I have a function that consumes a lot of RAM and I would like to let it run in the background for every time I call her not to have to reload all the data in memory,…
-
0
votes0
answers76
viewsError in Function mail() Windows Uol Host Platform. Returns 1 (True) but the email does not reach the recipient!
I have two simple functions that trigger e-mail (Recover Password). One works perfectly, the other does not accuse error, but the email does not reach the recipient. I would like a possible…
-
0
votes0
answers38
viewsHow do I make a javascript function work for a number of the same components individually?
For example: I have this function that checks if the checkbox is checked, but it works in general and not individually since these components are within a table, the components are generated in this…