Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Browsing all 207 articles
Browse latest View live
↧

Powershell function returns stdout? (Old title: Powershell append to array of...

I've learnt from this thread how to append to an array of arrays. However, I've observed the weirdest behaviour ever. It seems to append stdout too! Suppose I want to append to an array of arrays, but...

View Article


Return type for *this in a builder-class method - lvalue vs rvalue refence

Suppose I have a "builder" class B which builds a class C, and looks somewhat like the following:class B {public: // ... B& set_foo(Foo a_foo) { foo_ = std::move(a_foo); return *this; } C build()...

View Article


How can I return two values from a function in Python?

I would like to return two values from a function in two separate variables. For example:def select_choice(): loop = 1 row = 0 while loop == 1: print('''Choose from the following options?: 1. Row 1 2....

View Article

Custom pow function returns 0 for large exponent in C [closed]

As a beginner in C, I made my own pow function.The type of arguments in the function and the return value are all long long int.Here is the code:typedef long long int lli;lli p0wer(lli base, lli exp){...

View Article

How to define the return type / OutputType of a function

Why is the following changing type?function SomeFunction($SomeParameter){ return $SomeParameter}I guess I need to set a return type, but how?An example is using:$NewFolder=Join-Path $CurrentFolder...

View Article


Image may be NSFW.
Clik here to view.

Powershell function return pscustomobject out-gridview show incorrectly results

This function: function Get-UserNameSIDfromAD { param( [string] $LoginName ) [string] $domain [string] $username $domain, $username = $LoginName.split('\') $w32usracc = Get-CimInstance -ClassName...

View Article

How to enforce the use of a method's return value in C#?

I have a piece of software written with fluent syntax. The method chain has a definitive "ending", before which nothing useful is actually done in the code (think NBuilder, or Linq-to-SQL's query...

View Article

python function definition to find if all values in a list are even odd or...

I am struggling in a college beginner's computer science course and just need simple homework help.Now, we are currently working on function definitions, and I have to write a program that reads a list...

View Article


Constructed object returns from function as NoneType [closed]

I have a function that generates a level (with the layout referred to as board in the function, stored as a numpy.array). As this level needs to have a few properties, I tried to group these properties...

View Article


Return instance by value from a method stack compilation

Can you explain why this won't compile:(this is the error: ../Man.cpp:33:9: error: conversion from ‘Man (*)()’ to non-scalar type ‘Man’ requested)Code:Man goo(){ Man m(); return m;}but this does:Man...

View Article

is it possible to return two vectors from a function?

Im trying to do a merge sort in cpp on a vector called x, which contains x coordinates. As the mergesort sorts the x coordinates, its supposed to move the corresponding elements in a vector called y,...

View Article

React to return value of a function not working properly

I'd like to react to return value of a function, but my code is not working properly:#!/bin/bashclearecho $(sudo pacman -Rcs "$(pacman -Qdtq)")if [[ $(sudo pacman -Rcs "$(pacman -Qdtq)") == "Error:"*...

View Article

In C++, is the overloading of the arrow operator an exceptional case or does...

I have a question regarding the arrow operator's overload process. The overloading makes it seem like it is a unary operator, while the usage makes it appear as a binary operator. The return value...

View Article


Why the method doesn't work, however the same algorithm in another method works?

I have a database with Entity Framework, using a repository design pattern. There's a method in my repository which gets two inputs, an entity and an IQueryable<Entity> collection. The method...

View Article

Best way to use only one of multiple return values: indexing or unpacking...

Given some function with more than one return value, e.g.def example(): return 1, 2One could access only one of these values in different ways; for instanceOption A:val = example()[0]Option B:val, _ =...

View Article


Can a specific element from the array returned from a function be directly...

If myFunction returns an array, is there a simpler way of doing this?$result = myFunction($parameters);$result = $result[4];

View Article

jQuery Ajax returns the whole page

I have a jquery-ajax function that sends data to a php script and the problem is with the return value, it returns the whole page instead of single value.$("#ajaxBtn").click(function(){ var inputText =...

View Article


How to force compilation error if function return value is not checked?

I want the compiler to emit an error if I'm using a specific function without checking its return value.I'm using GCC in eclipse.For example :int fun (){ return 3;}void main (){ printf("%d",fun ());}I...

View Article

LaTeX returning lists from helper commands

I am attempting to use a helper function to remove a number from a list, specifically for Sudoku puzzle pencil marks in my case. In the following code, I'm unable to get the function to return the...

View Article

How to detect QObject::moveToThread() failure in Qt5?

The documentation on QObject::moveToThread() for Qt5.3 explains that the moveToThread() method can fail if the object has a parent. How would I detect this failure in my code?I realize that simply...

View Article
Browsing all 207 articles
Browse latest View live