Skip to content
Advertisement

Tag: return

JAVA Do/while loop not returning the value

I’m new at stackoverflow and coding. I’m trying to make a method for validating the user input. The user is only allowed to answer, add, show or exit. But I keep getting stuck in the first while loop. I tried to change it to !userChoice.equals.. but it is not working. What am I doing wrong. Answer Your posted code has

Two sum return statement returns nothing

I’m trying to attempt a problem where I must add two elements in an array to equal a target integer value. I think my code is correct and will return the desired target however the return statement is not returning any value. why is this and how can I fix it? Thanks Answer break is wrongly used. Also, you have

ANTLR4 Return values from a function

Im making a programming language as a project at my University and I’ve run into a problem with adding a return statement in functions. This is my grammar: And here is the custom visitor To help with transferring data I have made classes to carry values and function data. The problem I have atm is when I make a function

Advertisement