Skip to main content
Filter by
Sorted by
Tagged with
Advice
1 vote
9 replies
206 views

Currently following CS50 and learning recursion in C. This program returns the number of steps taken to get from n to 1, using the Collatz conjecture. I understand most of what's going on here, except ...
Ratthew's user avatar
2 votes
2 answers
169 views

I wrote a method that returns a reference to a variable (ref return), and sometimes the returned reference can be null. After calling this method I have to check if the reference is null, and I am ...
Theodor Zoulias's user avatar
Advice
0 votes
4 replies
121 views

I have a question about how try/finally behaves when using return statements in C#. Consider the following methods: public int Test() { return 12; } public int Test2() { try { ...
Colin's user avatar
  • 41
Advice
0 votes
1 replies
66 views

For example, does the Go language spec guarantee the following will print true? https://go.dev/play/p/Rybua4uBb87 package main import "fmt" func main() { fmt.Println(...
hfiggs's user avatar
  • 36
1 vote
1 answer
73 views

I am using ASP.NET MVC. I have a PIF controller and on the details view, I have data showing from a variety of other models, one of which is called SAEs (I will use this as the example). For each of ...
Sally Parkes's user avatar
1 vote
1 answer
145 views

Suppose I'm implementing the function returning an std::optional<T>. In that function, I compute some condition, and then want to return either a value, or a nullopt. I can do it like so: std::...
einpoklum's user avatar
  • 139k
0 votes
0 answers
73 views

With GDB I can set a breakpoint when a function is entered using break my_func. Is it possible to set a breakpoint on any return of a function? For example in this function, I'd want a breakpoint on ...
beyarkay's user avatar
  • 1,183
0 votes
0 answers
77 views

In my React project, the TaskForm component is showing an error saying that the return is outside the function. Even though I've reviewed and "fixed" it, the same error persists. Can someone ...
Erick Abraao's user avatar
0 votes
1 answer
62 views

I have a serious problem with an app. I have a selection box with types of services and other below with student names. Once selected the service, the students will be filtered to the ones that are ...
machsantos's user avatar
-1 votes
1 answer
72 views

This is my login authentication API. def login(): if request.method == 'OPTIONS': return jsonify({'message': 'CORS preflight successful'}), 200 data = request.json email = data....
rucha_0803's user avatar
-2 votes
2 answers
95 views

I have five classes. My Main class, a form class, two subclasses that extend the form class and a createForm class I am forced to use to create new instances of the subclass. public class FormenFabrik ...
Wannabree's user avatar
2 votes
1 answer
118 views

If you apply return to 'a' you get a value of type m Char, belonging to the Monad class: :t return 'a' → return 'a' :: Monad m => m Char. If you apply the resulting value to some other value, say, ...
Skab's user avatar
  • 83
-5 votes
1 answer
104 views

I need to make a function that returns a sentence with variables in it. But how do I exclude all the special string characters that I don't need? (e.g. ( or , or ') ef area_of_triangle( bottom, height ...
Icode15promax's user avatar
-4 votes
1 answer
117 views

It's a simple if greater than, then make it the value of BigHigh/BigLow, however it does not return successfully to main for the printout of the respective data. Instead, the printout reads 0 for both ...
Mathieu Bayana's user avatar
0 votes
1 answer
73 views

I implemented a Modbus.Net v1.4.3 client and poll data peridoically in a main program and experience strange behaviour. Every 6th poll gives: Data = null Success = false ErrorCode = 0 ErrorMsg ...
stadla_'s user avatar
0 votes
1 answer
41 views

I want to use breakout(var) instead of typing that if statement a million times. How do I make that work? Return returns from the function but I want to end the hotkey. f::{ send "a" ...
kite's user avatar
  • 363
0 votes
0 answers
71 views

As I filter products from an API using JavaScript's filter() method, I cannot obtain the desired range of products defined by price checkboxes in HTML. The filering works when using an if statement ...
Diogo Dust's user avatar
-1 votes
1 answer
57 views

well, i've been trying to make my first discord bot and i watched this video to help me do a logging script that shows in the terminal, but the responses.py the guy did in the video made the bot ...
ActuallyBlaze's user avatar
-1 votes
1 answer
74 views

I have that code .. its normal tabs javascript I need when i resize the window .. To bigest then > 450px tabs back to default i mean tab2 automatic back to tab1 .. Cuz i use it in my menu I tried ...
Ahmed DeSigner's user avatar
0 votes
1 answer
119 views

The question from PythonProgramming came closest to my question but the answer was unsatisfactory. There is very little documentation on Python-In-Excel. I am running a Python script INSIDE Excel ...
Mark Barry's user avatar
0 votes
0 answers
35 views

C++ 20 I have this function: int (*funcArrayReturn())[6]; The function returns a pointer to an array int[6] (6 elements aggregated). And I need a pointer of pointers of n elements(in this case 3) ...
BeginnerVS2019's user avatar
0 votes
1 answer
53 views

I'm interacting with GUI controls from a separate thread when invoked i'm always getting a "nothing" object despite what I think is the right code? Not sure where it's breaking. the second ...
Michal Bogs's user avatar
-1 votes
2 answers
258 views

I'm learning about functions in JavaScript and I'm confused about the role of console.log() and return. function reusableFunction() { console.log("Hi World"); } reusableFunction(); I ...
Matthew Walton's user avatar
0 votes
0 answers
106 views

I'm trying to clean and organize my data from a CSV file using Python and Pandas. Specifically, I want to extract structured information (like Social Security Numbers, Date of Birth, and Relationships)...
Hoko L's user avatar
  • 117
-1 votes
4 answers
158 views

The first code block outputs: "NameError: name 'timefloat' is not defined" while the other works as intended. Why is that? Code Block 1: raises ERROR def main(): time = input("...
user27764244's user avatar
0 votes
2 answers
57 views

I have the below function which is completing 2 tasks asynchronously to upload data to Firebase Firestore. The 2nd function is returning the documentId of the new document created in Firestore and ...
GVG's user avatar
  • 657
1 vote
4 answers
204 views

I often find myself typing this pattern for a variety of reasons: return <expr> if <expr> Not only does this seem wasteful, but if <expr> has any sort of evaluation time, then it ...
David Ljung Madison Stellar's user avatar
0 votes
2 answers
69 views

How do I prove the following Dafny program? method return_loop() returns (r:int) ensures r == 5 { var i := 0; while i < 10 invariant 0<= i <= 10 { if i == 5{ return i; ...
Anwar's user avatar
  • 11
1 vote
1 answer
49 views

balance = 0 def display_menu(): balance = 0 choice = ' ' if choice == ' ': print('1.Check Balance \n2.Deposit \n3.Withdraw \n4.Exit') choice = int(input('Please make a ...
gabe ortega's user avatar
2 votes
2 answers
134 views

I'm currently writing a program to return all additions to a number subtracted from itself (For example, if 3 were the number, the output should be 6 (3+2+1). Essentially, I'm trying to have the ...
Ratdude's user avatar
  • 93
-3 votes
1 answer
58 views

# Sample Code import datetime sample = { "Eat": [ datetime.datetime(2024, 9, 13, 2, 0), datetime.datetime(2024, 9, 13, 3, 0), "2024-09-13 20:43:35.440898&...
Ethan Radebaugh's user avatar
0 votes
0 answers
190 views

I'm working on a Next.js project where I want to redirect the user after a successful login, but also return the user data for further processing. Here’s my code: if (response.data.user) { ...
Haseeb Usman's user avatar
0 votes
1 answer
37 views

Hi please can you help. I'm trying to select the last 200 rows in my database, then compare 2 fields in each row, and return each whole row where there is only 1 instance. So, all rows that have more ...
Nickmall's user avatar
2 votes
1 answer
180 views

If there is [[noreturn]] (C2X, n3301), then why there is no [[always_return]]? The semantics of [[always_return]] may be the following: A function declared with an [[always_return]] attribute shall ...
pmor's user avatar
  • 6,929
0 votes
0 answers
259 views

After having looked around a bit and not having understood anything I still have the question whether it is necessary to use return; after a wp_send_json_error(); I read that the wp_send_json_error ...
LordSnake's user avatar
-1 votes
2 answers
73 views

I thought I understood recursive functions but realised I don't actually understand what is happening under the bonnet Running this Python code to generate a triangular series gives the expected ...
JonP's user avatar
  • 3
1 vote
1 answer
104 views

The searchInsert function return the index where the target should be based on the value. Why it should have the line return -1; in the following code? I thought I included all the possible outcomes ...
Yi Zhao's user avatar
  • 21
0 votes
0 answers
28 views

@staticmethod def log_in(): logged_in = False while not logged_in: username = input("Username: ") if not(User.user_exists(username)): ...
JOHNWIKYWOK's user avatar
0 votes
0 answers
20 views

My goal is to limit the length of an input of type number to just one number. For this I used the response of Vikasdeep Singh in this SO answer which in my case is working perfectly. I also had to ...
Mehdi's user avatar
  • 1,802
1 vote
2 answers
141 views

I was trying to figure out the differences between terminate(), exit() and abort(), and Microsoft's C++ program termination documentation came up in my Google search that compares exit vs abort vs ...
heretoinfinity's user avatar
0 votes
1 answer
102 views

Hello in my program I need to implement a recursive descent and return from recursive calls. Input data (100, 37). I was able to print the recursive descent, but I do not understand how to print the ...
Евгений Смирнов's user avatar
-1 votes
1 answer
126 views

Currently I am trying to create a linked list. Here is the class I am using to create nodes: class node{ public: int item; node* ptr_next; node(int new_item = 0, node* ...
timmy george's user avatar
1 vote
1 answer
250 views

I have the following Z80 asm code (from pokemon legacy crystal) CheckOnWater:: ld a, [wPlayerStandingTile] call GetTileCollision sub WATER_TILE ret z and a ret i was wondering ...
nnolte's user avatar
  • 1,800
-5 votes
1 answer
102 views

package Pyramid; import java.util.Scanner; public class SquareVolume { public static void main(String[] args) { double length = 0; double width = 0; double height = 0; ...
Michael.T's user avatar
0 votes
3 answers
91 views

this code below is from Grokking Algorithms book that is an exercise for the functional programming/recursion and an application for the D&C concept. the function finds the maximum number in a ...
Ahmed Salah's user avatar
-5 votes
1 answer
69 views

I wrote the short program below while practising how to use a custom function. def square(num): square==(num**2) print(square(10)) return I was expecting that when I call the function: ...
techgo limited's user avatar
0 votes
2 answers
74 views

I was writing this code where I am making some Modals so I wrote this code import { useContext } from "react" import { ModalContext } from "../ModalProvider" import { ...
Divyansh Pathak's user avatar
0 votes
1 answer
53 views

I need to store a value of json response to use in another function. I have this code: const url_moodle = "https://xxxxx/xxxxx/app/appmoodlejson.php"; var moodleEmail = function (email){ $...
Dixander Carballo Buque's user avatar
0 votes
0 answers
27 views

I am currently building a vocabulary trainer for my assignment. I'm using flask and javascript in the backend. One function retrieves the vocabulary ID primary key from the database, and I need it in ...
hehe's user avatar
  • 1
0 votes
0 answers
50 views

#include <iostream> //class for testing** class T { public: void print() { std::cout << "hello\n"; } ~T() { std::cout << "~T\n";} }; //function for ...
Kappy's user avatar
  • 27

1
2 3 4 5
233