Questions tagged [goto]

In imperative programming, a "go to" statement is an unconditional jump instruction that changes the flow of control to the point of the program referenced by the "go to" statement.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
81 views

How can i loop the main function?

EDITED I am doing a bank management system project, when i get to loop my main function the output is not what i expect. the code works fine and outputs the expected data when not looping but as soon ...
Equilfy's user avatar
-3 votes
0 answers
45 views

Any Java function that is similar to C++ (goto) function [duplicate]

is there any Java function similar to C++ (goto), because based on this code I want to let the user to select other menu once they done selecting their car, for example go back to main menu to select ...
Lee's user avatar
  • 1
0 votes
2 answers
63 views

Batch file for Windows - problem with goto

I'm writing a Windows batch file which starts an executable file depending on the status of the wifi connection, and a user choice. The script uses an infinite loop with a for. echo off SETLOCAL ...
Lorenzo's user avatar
-4 votes
2 answers
49 views

Change the flow of code dynamically in Python

So im writing this calculator program, and at the end of it I want to give the user an option to run it again or close the program. I thought there was a "goto" function, but apparenty that ...
user22936938's user avatar
0 votes
0 answers
36 views

how can i get this box to accept my question? Question - VBA error GOTO challenge [duplicate]

I am trying to use "Error goto" and I think its not difficult. I am trying to get the 2nd VBA code to... on error, jump to "Sheets("RISA").Select" if the find within the ...
Hayden's user avatar
  • 1
0 votes
1 answer
42 views

Batch Script to stop Inner Loop when first instance of string is found

I have a folder with a lot of sub-directories, each with a .diff file that I want to perform a search in for a specific string using a batch script. Because of our IT requirements, I do not have ...
Sara Weindorf's user avatar
1 vote
1 answer
92 views

In Fortran IV, how are arrays assigned by a single value, and how are some goto operations handled?

I have a semantic problem with a very old Fortran IV (Fortran 66) program. This leads to 2 questions. Context The program should calculate the Ackermann function in O(1) memory. It comes from here: ...
Frédéric Gava's user avatar
0 votes
2 answers
215 views

Svelte goto using slug

I'm using svelte for a personnal project and i'm wondering if someone has the trick to do that. I've a list of blog pages and for each pages i've a next_page and previous_page url The problem is: from ...
Samuel Pelsy's user avatar
0 votes
1 answer
45 views

Given OpenSSL's int return style error handling, how can I handle errors in OpenSSL functions without leading to memory leak? [duplicate]

This question leans toward the "design" aspect of things, but I wanted to know how others might have dealt with this issue and might do so now considering current programming trends in C. So ...
z.karl's user avatar
  • 295
1 vote
1 answer
61 views

How do you activate a line of code that happened before?

I am new to Java coding and am practising by making a calculator. I want it so that when I type Restart it does the the operation selection part. import java.util.Objects; import java.util.Scanner; ...
ThunderCoder's user avatar
0 votes
1 answer
74 views

Why does my code stop even though if statement is false

in this small chess terminal app, at the end of black's turn, the code should check if move contains '#' if so, it should exit. The problem is, it automatically exits and doesn't check the second if ...
MecMcCallister's user avatar
-1 votes
1 answer
48 views

Is there a way to avoid code duplication caused by 'out of scope' error in C#?

C# goto out of scope error means I have to duplicate code - is there a better way? This is just a rough example, but there are often multiple statements that may fold into the same code and I don't ...
alank2's user avatar
  • 1
-3 votes
1 answer
72 views

Goto function seems to loop the first half of the code

I normally don't create codes for myself, but today (or tonight, depending on your time zone) I created a simple calculator code which lets you enter multiple numbers, not just two items. This was a ...
aidiotwholikescoding's user avatar
0 votes
1 answer
81 views

Replacing instead of adding prefix in batch script

I`m writing a batch script file to add prefix to all .txt files in same folder with batch file @echo off if "%1"=="" ( exit /b ) :loop if "%1"=="" goto end ...
LogS's user avatar
  • 1
0 votes
2 answers
86 views

JavaScript jump to label

I'm trying to make a function that validates user input and return true if there are no mistakes or false (and display a message) if there is a problem. If an error found, there is no need to check ...
bbProg's user avatar
  • 7
-1 votes
1 answer
66 views

Various goto implementations in Java

I have a code in c++ with goto statement and would like to know if my Java implementation is correct. Please suggest if there is any other efficient way to get this implemented in JAVA code. Here is ...
Scra's user avatar
  • 97
0 votes
1 answer
56 views

why does goto loop stop iteration when condition is FALSE?

I am trying to iterate through the NORTHWIND data in SQL Server as such: DECLARE @Vcatid INT = 1 DECLARE @Vcatname NVARCHAR(255) DECLARE @Vdesc NVARCHAR(255) GOTO_Table: SELECT @Vcatid = ...
doron's user avatar
  • 11
0 votes
1 answer
969 views

Why does Svelte goto statement doesn't work on root?

Ok, so I am trying to build a simple login page with a Svelte app, for now it have almost no logic at all, but I am just trying to play a little bit with the Svelte store. But I am encountering a ...
bragdon's user avatar
  • 29
0 votes
0 answers
84 views

Bypasses initialisation in goto statement [duplicate]

I've come across an error that I thought should have been a warning: char* p; int main() { if (p) goto continue_func; int a = 3; continue_func: int b = 2; } The error I get: ...
Zebrafish's user avatar
  • 12.1k
1 vote
1 answer
87 views

C macros: Jump to next label (using __COUNTER__?)

Context: I am trying to create macros to create some efficient coroutines. In my concept, the function has multiple passes (running, cleaning, checking). Currently I implement it using switch/case The ...
Yaroslaff Fedin's user avatar
0 votes
2 answers
99 views

How to check if an element of an array has already been inserted in that array in a "fashionable" way?

Context: An exercise asks me to: Create an array of 20 elements; Insert manually 20 numbers, ranging from 10 to 100 (these included), in said array; If the inserted number (example: x) is not 10 <=...
Gisvaldo's user avatar
0 votes
3 answers
78 views

Reducing Select statements in for loop

Does any functionality in vba exist where I can essentially index methods in a loop rather than index matching them?? I want to avoid repeating the for loop many times as it will make the code messy ...
CamalotCoder's user avatar
-2 votes
1 answer
62 views

In my C# project,I want to exit Method1 on a specific condition, and execute Method2 without coming back to Method1 again. How can I do that?

In my C# project, I want to exit Method1 on a specific condition and execute another method (Method2) without return back to Method1. I want to prevent using jump statements (goto). How can I do that? ...
user avatar
0 votes
2 answers
1k views

Cannot import goto in sveltekit

I am using a brand new installation of sveltekit "svelte": "^3.54.0", When I try to import goto with this code import { goto } from "$app/navigation"; I get the ...
Paul A's user avatar
  • 397
2 votes
2 answers
5k views

Is there any way to use goto() without reloading page on SvelteKit?

I have one problem: I need to add additional part to url (IE: I have /route and I need to convert it to /route/something without reloading of the page. I’ve tried to use goto(), but it reloads the ...
oleh.lavryk's user avatar
1 vote
2 answers
56 views

Goto statement in filesystem exception handling

save: try { s.Save(); } catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { FSErrorDialog fsError = new(ex, FSVerb.Access, new FileInfo(path), Button.Retry, Button....
Scover's user avatar
  • 95
-2 votes
1 answer
1k views

How to decode this goto [duplicate]

What is this numbers name ?hash or what is this ? header("\110\124\124\x50\x2f\x31\x2e\x30\40\x34\60\x34\x20\x4e\x6f\164\40\106\157\x75\156\144"); How to decode this values of numbers? goto ...
Luke mos's user avatar
1 vote
2 answers
55 views

C Visual Studio goto skipping scanf_s

I'm coding in C on visual studio and can't seem to figure out a fix for scanf_s scanning only once. #include <stdio.h> #include <string.h> int main() { int duration; int cost; ...
Genata339's user avatar
2 votes
0 answers
706 views

Is it possible to implement direct jumps (i.e., GOTO) in Rust?

I'm exploring optimizations for the HVM, a parallel functional runtime written in Rust. The way it works by spawning several threads, and then having each one busy on a main work loop where tasks are ...
MaiaVictor's user avatar
  • 51.7k
1 vote
1 answer
86 views

Do all compilers support goto label addresses? [duplicate]

I was looking at this block of code: int main() { void *labels[] = { &&label1, &&label2 }; goto *labels[1]; label1: printf("Label 1\n"); label2: printf(...
FariyaAchhab's user avatar
0 votes
0 answers
65 views

Need Variable Label in GOTO Label statement and/or alternative to GOTO Label

I have a sequence of Math Expressions (say from 1 to 10), which are interdependent. Based on condition, I need to start the working from different start positions (i.e. Line numbers) e.g. in case 0 - ...
Kirti's user avatar
  • 1
0 votes
2 answers
336 views

C# - repeat for loop without using goto

Recently, when developing a calculator program, I found myself using goto multiple times to restart a for loop. Example: StartLoop: for (int i = 0; i < length; i++) { if (items[i] == condition)...
Elia Giaccardi Old's user avatar
0 votes
2 answers
58 views

Why I can't declare void * p in the end of longestCommonPrefix function?

I was solving leetcode problems in c when compiler gave me strange error. Why I can't declare void * p in the end of longestCommonPrefix function? #include <stdio.h> #include <math.h> #...
George Potoshin's user avatar
0 votes
1 answer
107 views

Jump to a specific cell based on Active Cell

I'm completely new to Java Scipt although over the years I've messed around with VBA & Macros in Excel. I am now using Google Sheets almost exclusively, hence needing to learn Java. I'm trying to ...
NGC Swindle's user avatar
2 votes
3 answers
2k views

Password validation program cpp

I am creating a password validation program and I want the password to contain the following: * Password must be between 8 to 15 characters long... * Password must contain at least one digit * ...
user avatar
-2 votes
2 answers
442 views

Is there any alternative to goto in Python?

Version: Python 3.7 for obj in group_obj.objects: bpy.ops.ed.undo_push() --> move_rotate(obj, T, T_0) | | if check_if_cross_wall(obj): | bpy.ops....
P. Scotty's user avatar
  • 155
0 votes
2 answers
927 views

VBA - GoTo Command

I'm trying to use the GoTo command in Excel to GoTo a variable cell value, but I'm struggle how to get the cell address into VBA, any thoughts? Within my Excel document I have defined the name of a ...
ANDJO's user avatar
  • 11
1 vote
1 answer
134 views

Go to a referenced cell when clicking "ok" in the message box

So my code starts on a different sheet with a button click. The code below stops the user from continuing with an error message if the user does not put in a value in cell "B38" on the "...
MisterBeans's user avatar
0 votes
1 answer
191 views

Perl: LABEL defined inside the foreach loop, and issue coming on jumping to the LABEL using "goto LABEL"

use strict; use warnings; my @content1=("sunTerio", "builds123", "build123_sunTerio", "glorai", "2131flow" , "build434_glorai"); my $tryVar; ...
PPP's user avatar
  • 315
0 votes
0 answers
478 views

How to create a button when clicked a specific cell is selected based on two conditions

=CELL("address",INDEX(G8:AO110,MATCH(G4,G8:G110,0),MATCH(F4,G8:AO8,0))) the above formula in excel produces a cell reference. i want to create a button when clicked the cell produced by ...
NEER ROME's user avatar
-3 votes
1 answer
59 views

how to use goto in a scanner function?

I tried to do a scanner function with goto to check if the vector with my dfa can be accepted, I'm having a problem with the logic, when I call the function the code starts to print in loop and it ...
orbit_show's user avatar
0 votes
2 answers
219 views

GOTO command in C

I've tried to sort 5 integers array using GOTO (using in for the first time) and if statement only, but I've debugged this code and I couldn't figure why that's not working, I don't fully understant ...
יונתן אליהו's user avatar
0 votes
4 answers
248 views

how to replace goto part in c

First, enter the coordinates of the vertex of the square. and each coordinate can not exceed 1000. Second, enter the current location of the coordinates. location of the coordinate cannot exceed ...
dongja's user avatar
  • 1
-1 votes
1 answer
81 views

How to make goto statements when not in scope in C#?

I'm currently working on a little lottery game in a console window made with C#. I added a feature that lets the user randomize the 6 numbers he will have on his ticket but noticed that my random ...
cloudified's user avatar
0 votes
1 answer
87 views

What is the reason for the unexpected behavior with GOTO in an IF/ELSE statement? [duplicate]

I wrote a batch script in which a query comes in an IF statement at the end, which sends the user back to the menu, terminates the script, or if the input is invalid, clears the console output and ...
Datasmuggler's user avatar
-1 votes
1 answer
79 views

Jump back to a line in code(goto function) when a certain word is entered in java

So I need some line of code to make it so that if one of the four words is entered, it jumps back to a certain line. This is for a text-based rpg game. if(input3.equalsIgnoreCase("Inside")) {...
Skylar Helter's user avatar
1 vote
2 answers
291 views

Where to free multiple mallocs

I have the following piece of code: void f(size_t n) { int *a = malloc(n * sizeof *a); if(a == NULL) { report_error_and_exit(); } int *b = malloc(n * sizeof *a); if(b == ...
talbi's user avatar
  • 200
1 vote
2 answers
108 views

How can I skip the goto statement if the user enters marks less than 100

Note: I am a beginner. I have used goto statement to execute if the user enters marks more than 200 but if the user has entered marks less than 100 then the rest of the code should run. How can I do ...
Fras Irfan's user avatar
-1 votes
2 answers
505 views

Does GOTO in CATCH block in c# execute FINALLY?

Pretty simple question: int retryAttempts = 3; retry: try { await getSemaphore(); throw new Exception(); } catch { if (0 > retryAttempts--) { await Task.Delay(5000); ...
André Reichelt's user avatar
0 votes
1 answer
129 views

split document based on Page number input by user using VBA

I have a document of several pages. I need to split it based on number of page supplied, by user. so following macro doing great when I run it by F8 key(Step by step) from VBA editor, However when I ...
VBAbyMBA's user avatar
  • 816

1
2 3 4 5
22