Unreachable code is part of the source code of a program which can never be executed because there exists no control flow path to the code from the rest of the program.
Questions tagged [unreachable-code]
181 questions
0
votes
1 answer
Unreachable code detected after transaction
I'm getting the warning 'Unreachable code detected' in my typescript file. Nothing works after running a Firebase transaction. Here's the transaction code:
// Create Firestore reference
let pointsRef = 'Users/'+this.user.uid;
var pointsDocRef =…

FiringBlanks
- 1,998
- 4
- 32
- 48
0
votes
2 answers
clicked.connect() will not access the method
I have a seperate script that calls this one... I don't understand why my button click is not going into the corresponding function. I am quite new at this so if you do know the answer, could you explain it to me so that I can learn it.
import…

Rajnine
- 3
- 3
0
votes
0 answers
Compiler warning C4702 (unreachable code) for x86 platform build, but not for x64
We build our project with Microsoft Visual Studio Professional 2015, Version 14.0.25431.01 Update 3. Exactly the same code gives us compiler warning C4702 (unreachable code) when the solution is built for x86 platform, but no warning, when it is…

Software Craftsman
- 2,999
- 2
- 31
- 47
0
votes
1 answer
kotlin unreachable code when using finally and enum
I've encoutered such issue, that android studio warns me about unreachable code. I don't understand, how it is unreachable.
My original code:
try {
return BasketProvider.valueOf(prefs.getString(KEY_BASKET_PROVIDER, null))…

Marius Kaunietis
- 674
- 4
- 17
0
votes
2 answers
unreachable code in scala
val LIST = scala.collection.mutable.MutableList[String]()
val filterF = new Function[Path, Boolean] {
def apply(x: Path): Boolean = {
println("looking into " + x)
val flag = if (x.toString.split("/").last.split("_").last.toLong <…

Vijay Krishna
- 1,037
- 13
- 19
0
votes
3 answers
Unreachable code when closing scanner in java?
When I try to close myScanner I get a red line under myScanner.close telling me it is unreachable code. What am I doing wrong?
public class crypt {
static final char FIRST = ' ';
static final char LAST = ']';
static final int RANGE =…

Stephany
- 3
- 3
0
votes
3 answers
Unreachable Code Detected (Why?)
So, why is it that there is unreachable code detected in this code:
public bool GetKeyPressed(KeyCode key)
{
for (int i = 0; i < keys.Count; i++)
if (keys[i].key == key && keys[i].pressed)
return true;
…
user6630825
0
votes
1 answer
Unrechable Statement if return Statement in Finally Block
public class UnrechableCode {
public static void main (String args[])
{
UnrechableCode uc=new UnrechableCode();
try
{
System.out.println(1/0);
}
…
0
votes
3 answers
Stuck in a loop of errors: unreachable statement and no return statement provided
Here is a snippet of my code:
public static int dc (String s,int k, int c){
String s1, s2;
int m, n;
if (check(s, k) != -1) {
int p = check(s, k);
c++;
s1 = s.substring(0, p) + s.substring(p + 1);
s2 = s.substring(0, p + 1) +…

Rohinb97
- 121
- 5
0
votes
1 answer
Code unreachable when comparing types
Question: My else-statement is unreachable, what am i doing wrong?
very VERY new at programming and i'm trying to compare the type so for example people can't enter strings when i'm asking for integers.
My code is probably pretty bad, if i could get…

Arvid Wikström Wiren
- 39
- 2
- 12
0
votes
2 answers
Why this code got "unreachable statement" error?
I have the following method :
char getChar(int I)
{
if (I<65+26) return (char)(I);
switch (I)
{
case 91 : return '?';break;
case 92 : return '#';break;
default : return ' ';
}
}
Why does it get "unreachable…

Frank
- 30,590
- 58
- 161
- 244
0
votes
2 answers
Unreachable Code Detected Warning with Regex
I am fairly new to C#, and feel like this is probably an obvious answer, since I understand what the error means--but I cannot for the life of me see how to fix it! I am getting an "unreachable code detected" warning for my second if statement, so I…
0
votes
5 answers
Why is the code not reachable?
the following is giving me a "code unreachable" message on 'out.close();'
I can't find the issue as it is more or less identical to other code I have run which worked!
import java.io.*;
import java.net.*;
public class MyClient {
private static…

CB Stewart
- 3
- 2
0
votes
2 answers
Response.Redirect unreachable code
Is there any circumstance that the red can be called given the green?

sammarcow
- 2,736
- 2
- 28
- 56
0
votes
3 answers
Unreachable code detected in the for loop
I'm trying to find out if a number is prime or not. But I've got an error of "unreachable code detected", which I think is effecting the error of "not all code paths return a value". The error seems to occur in the for loop at i++. Can anyone help…

Josh
- 49
- 1
- 1
- 2