Questions tagged [return-value]
Return value is the result of evaluation of a return statement.
4,704
questions
0
votes
0
answers
4
views
Countif, sumif, or any other relevant formulas
If same name appears multiple times then,
for 1st time it should sum and return the value
but for next times it should exclude the 1st value of same name and same range and sum remaining values
And ...
0
votes
1
answer
39
views
r shiny how to use lapply with moduleServer that returns a reactive that I want to observe
I'm trying to simplify my code. Rather than copy/pasting similar elements, I want to define a list that describes them and then lapply to get them. I need two/way communication with a global setting.
...
-4
votes
2
answers
46
views
Why do return and print statements in for-loop don't work together in Python?
Can you please explain why does this function prints -1 only once, when it has to print it on each loop cycle? However, when I remove line 9 return -1, it prints -1 4 times, as it should be. How does ...
-1
votes
1
answer
22
views
Why is Python returning None if the input before the accepted input is incorrect? [duplicate]
The Python code:
def force_input(type):
try:
return type(input())
except ValueError:
print(f'Input must be {type}')
force_input(type)
number = force_input(int)
print(...
0
votes
0
answers
17
views
How to print specific value from line in a file
I have created a search that will find data in a file. The data that gets printed contains a value that I would like to be shown instead of the whole line.
With the below code, I search for OMXS303F; ...
-2
votes
2
answers
75
views
Function return a string and frintf() behavior in C language
I am learning how to function return a string in C. It has 2 ways: use static char array or use malloc. I have some experiments with source code be like:
#include <stdio.h>
#include <stdlib.h&...
1
vote
1
answer
95
views
Message not retaining values set in function
I am initializing a bigquery_datatransfer_v1.types.ScheduleOptions message and setting its values based on logic in a function. I have tried including the values in the constructor of the message, and ...
0
votes
1
answer
87
views
VBA function does not return dynamic array
I am using Excel365. Below function is intended to have SumProduct work with arrays that contain empty cells generated by a formula - when the result of the formula is "", SumProduct has ...
0
votes
1
answer
18
views
Error : Expected to return a value at the end of arrow function
Expected to return a value at the end of arrow function , this is a common problem one can face easily while using react JSX in strict mode
contentType = id => {
console.log('')
if (id === '...
-1
votes
1
answer
35
views
Does arr.filter call callbackFn twice?
First time asker.
I came across this code from the page below:
function inBetween(a, b) {
return function(x) {
return x >= a && x <= b;
};
}
let arr = [1, 2, 3, 4, 5, 6, 7];
...
0
votes
1
answer
57
views
How to return value from stored procedure?
CREATE OR REPLACE PROCEDURE distances(IN flight_num1 Integer)
LANGUAGE 'plpgsql'
AS
DECLARE
BEGIN
SELECT
*,
CASE
WHEN distance_miles >= 0 AND distance_miles <= ...
0
votes
0
answers
13
views
Get value from option field in contact form 7
How can I add value in option field in contact form 7? It should be show on view source code too.
I want value like If user select Apple, I want value as 122.
If user select Mango, I want value as ...
0
votes
2
answers
34
views
POWER BI: Show the Value from a Cell with a measure : using Dynamic Index || Count Dax Formula?
I have a table of power market which contains a column of Daily Return called "LN" (Sort Descending).
I have written a measure which has given me the specific number of the row containing ...
0
votes
1
answer
23
views
How can I return different values in a FormComponent method?
I have this method that is going to create 2 textfields and a combobox.
But I have a problem returning the different values because it gives me an error that "Type mismatch: cannot convert from ...
0
votes
0
answers
26
views
Odd Excel Search
I'm stumped. I need excel to look at the value in M2 and find an exact match in column K. When it finds an exact Match in colomn K, I need it to copy the contents of the cell 3 to the right of the ...
0
votes
1
answer
30
views
Assembly always returns 0 [duplicate]
This are the instructions that I have:
global _start
_start:
mov ecx, 0x12
mov ebx, 0x2
label:
add ebx, ebx
dec ecx
cmp ecx, 0
jg label
mov eax, 1
int 0x80
I am new ...
3
votes
3
answers
117
views
Is there a "return NULL" equivalent for return-by-reference functions?
I'm working with existing code that returns a reference, something like this:
int &func()
{
static int i = 5;
return i;
}
I would like to return an error case as "NULL" but of ...
1
vote
2
answers
66
views
Reading multiple return values from goroutines
I'm trying to write wc(1) in Go, and I'm experimenting with goroutines in an effort to count large number of input files more efficiently. My code works fine as it is, but I have a hard time ...
0
votes
2
answers
30
views
Overwriting form elements
My application is used to calculate the household budget. I encountered the following problem.
At first, I entered a few items into the list
enter image description here
I clicked the edit button to ...
0
votes
0
answers
37
views
Multichannel adc with dma values are not exact
I use multichannel(7 channels) adc1 in circular an scan mode with dma.i use ll functions and read adc values in dma_stream_IRQHandler function.the values are not exact and stable.adc sample clock is ...
-2
votes
5
answers
103
views
how does main function knows the void function is executed successfully in C?
In this simple program in C
#include <stdio.h>
void hello() {
printf("hey i am from void function\n");
}
int main() {
hello();
return 0;
}
Output:
hey i am from void ...
1
vote
2
answers
76
views
Why Return value in C limits to 0 to 256
Here are the simple programs in C that returns different values
program : 1
#include<stdio.h>
int main()
{
printf("Hey I am returning the value\n");
return 0;
}
program 2:
#...
0
votes
0
answers
33
views
Rounding up even if Python is also less than 0.5 [duplicate]
How to Rounding up even if Python is also less than 0.5?
I use round() but if value is 3.12 less than 3.5 rounded value is 3 but I do want returned value is 4.
process it may vary depend on the enter ...
-1
votes
1
answer
38
views
Why does my function self.deleteTime == None?
So as you can see in the code it should return a random number between 2 and 10 but in return None why??
self.deleteTime = self.buttonGrow.is_pressed(mousePos, mousePressed)
...
-1
votes
3
answers
41
views
AppleScript, manipulate the return value from a one-liner tell-statement, still on the same line?
tell application "Finder" to get bounds of window of desktop
returns something like
{0, 0, 1440, 900}
How can I do something like
get item 3 of (tell application "Finder" to get ...
0
votes
1
answer
53
views
How to find a date and number from a file, with Get Current Date?
I have a file, dates.txt, which has dates in dd.mm.yyyy format, and a number next to it, and now I need to return just the number on correct date. I use Get Current Date and for example, on 15.08.2023,...
-1
votes
1
answer
70
views
Why is stored procedure ReturnValue null in C# when it has value in SQL? [duplicate]
I have a stored procedure in SQL server that returns 0 at the end as shown:
create procedure myProc
as
begin
select * from sampleTable
return 0
end
This value is returned as expected when ...
0
votes
1
answer
32
views
How to return the ID of an option element on click?
I've been researching a lot of different methods to try and return the the ID of various elements, options of a list to start, but none of them either seem to be what i'm looking for nor do the ones I ...
-2
votes
3
answers
92
views
Unable to prove palindrome number for "11" in C programming
leet code palindrome problem, i am trying to prove test case " 11 " is a palindrome but i am unable to , despite other test cases passsing correctly
bool isPalindrome(int x){
if(x<0)
...
0
votes
1
answer
124
views
Does it work when a reference refers to a function's return value?
class AA {
private:
string s = "asd";
public:
string func1() {
return s;
}
string& func2() {
return s;
}
};
func1() returns a copy and func2() ...
0
votes
2
answers
34
views
How can I check value returned by rand() with GDB
So I am debugging my random game in GDB to break how to easily guess numbers.
Line I am referring to in code is:
winning_number= (rand() % 20) + 1
After I disassembled the function it looks like this:
...
0
votes
2
answers
73
views
I can't return the substring() data with any function types in my own string function
I'm trying to create my own string,
I have problem in creating substr() function,
I can't return the value, all I can do is print the value by void function.
char String::SubString(const size_t& ...
1
vote
1
answer
21
views
return from database only one value
I want to return only one value from db
Hi i have python code:
@app.route('/actor_genre_list/<int:id>', methods=['GET'])
def actor_genre_list(id):
genre_id = queries.get_actor_genres(id)
...
1
vote
1
answer
43
views
Giving two template class as arguments, choose the return template class using a hierarchy order
I have a class Matrix defined as template<class T, int m_rows, int m_cols = m_rows> class Matrix and an overloaded operator of the type template <class V, int m_cols2> Matrix operator * (...
0
votes
0
answers
22
views
LineEdit doesn't show exception from another class, crashes when returning value
I have two modules; one is a frequency parser that should return a value in Hz otherwise through some exceptions depending on different mistakes in the user input.
Here is the code (ModuleParse.py):
...
0
votes
1
answer
74
views
How to access nested object properties in array of object
I am trying to access property values from an array of objects. I can access PurchaseOrder and DocumentCurrency property but not able to access NetPriceAmount
NetPriceAmount property is part of ...
0
votes
0
answers
29
views
Searching xlsx files in a folder and look for specific elements in all sheets
I am trying to get values from all excel sheets in a given directory and search for the cell value next to a text. However, in the excel sheets I have those cell values are as formulas and I am having ...
0
votes
1
answer
48
views
Binary-Search and Return value
function searchTarget(N, A, X) {
let start = 0;`=
let end = A.length - 1;
// = mid , < mid , > mid (3 sections)
// so the target element which needs to be searched lies among ...
0
votes
2
answers
81
views
Why string copied by strcpy() after returning from function is null in C
I have the following test:
char* test1()
{
char* string = "test 1\n";
printf("In function: %s", string);
return string;
}
char* test2()
{
char* string[10];
...
0
votes
0
answers
20
views
def double (num): """ function to double the number """ return 2 * num print double (10)
def double (num):
"""
function to double the number
"""
return 2 * num
print double (10)
#getting error like this, Missing parentheses in call to 'print'. Did you mean ...
0
votes
1
answer
28
views
Trouble with retrieving only values from an Excel file using load_workbook() in Python
On Python, I use:
wbin = load_workbook(filein, data_only=True)
Since in the filein there are some functions and I need the value, but the option data_only=True doesn't work.
Some cells contains ...
0
votes
4
answers
105
views
Print leaves node parent binary tree
My C++ exercise is about printing leave parent nodes in a binary tree. I've worked on two ideas to accomplish that. They are the following
Idea 1
/* Write a program that finds and prints all vertices ...
0
votes
2
answers
24
views
return the Scanner inputs by calling the methods and return it to the public class value
import java.util.Scanner;
public class UI {
Scanner input = new Scanner(System.in);
int Store ,Week = play();
public int play() {
System.out.print(" Please enter the store #...
1
vote
0
answers
25
views
ValueError: Data cardinality is ambiguous: in data size
I am an apprentice of this programming language that I am passionate about. I am trying to make a gcn model with the lines that I show you, however, I get the error:
Greetings, When writing and ...
1
vote
2
answers
66
views
When running my function it won't return me a value, what am I doing wrong?
I'm currently working on the Cash assignment for Week 1 in CS50, and everything was running smoothly until I moved past quarters. The objective is to get the input form the user on how much change ...
0
votes
2
answers
61
views
Looking for explanation of what's happening in this recursive Python snippet? [duplicate]
The snippet:
def fun(a):
if a > 30:
return 3
else:
return a + fun(a+3)
print(fun(25)) # prints 56
Now my question is this: The return from the function does ...
0
votes
0
answers
31
views
'score' value in the form always return as 0
in my school project, we created a basic Django app using questionnaires and videos to calculate depression. but on the final result page questionnaire 'score' always return as 0. Why is that?
I can ...
0
votes
0
answers
77
views
ValueError: could not convert string to float: '1,004.30'
I have a dataset of cryptocurrency. I have features as ['Open', 'High', 'Low', 'Vol.', 'Change %'] and target variable as ['Price'].
I want to fit multiple regression even after converting the price ...
0
votes
0
answers
100
views
Display the name instead of value in mat-select AutoComplete
`I want to display the name (employee Name) instead of value (employee id), while trying to pick an employee by name in the drop down.
Sample Data:
0: {employeeID: 13, employeeName: 'vinayakar G'}
1: {...
0
votes
1
answer
28
views
Wrapper around instance methods with default return value
I have a dozen of (instance) methods that should evaluate only if a condition is satisfied, otherwise return default value which is different for each method:
def fun(self, *args, **kwargs):
if ...