if ( variable )
{
    
}
else
{
    Console.WriteLine("Wrong")
}

He doesn't know what "Not" is it :|

By Manoochehr Mojgani, 2017-12-13 17:05:36
int file_exist(){
    FILE *file;
    if((file = fopen(SCORE_FILE_NAME, "r"))){
        fclose(file);
        return 1;
    }
    return 0;
}
By Anonymous, 2020-06-08 12:01:54
product = None
for key in dictionary.keys():
	if product is None:
		product = dictionary[key]
	else:
		product = itertools.product(product, dictionary[key])

product = "{0}".format(list(product))
product = re.sub(r"\), \(+", "], [", product)
product = re.sub(r"\(+", "[", product)
product = product.replace(")]", "]]").replace(")", "")
product = ast.literal_eval(product)

Ok, I have a weird array of objects as output of itertools and I need an array of strings... 1 - Convert the array to string 2 - Clean it up with regex and replace 3 - Convert the string to array 4 - Problem solved

By AnonimaPitoni, 2018-09-06 00:27:34
public class SentCon3 {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		double input;
		char choice;
		System.out.println("**** Menu-Driven Temperature Converter*****");
		System.out.println("only lowwer case is vaild");
		System.out.print("Enter the value to beconverted==> ");
		input = scan.nextDouble();
		System.out.println("What is your choice?");
		System.out.println("a)Fahrenheit to Celsius");
		System.out.println("b)Celsius to Fahrenheit");
		System.out.println("c)Kelvin to Celsius");
		System.out.println("d)Celsius to Kelvin");
		System.out.println("e)Kelvin to Fahrenheit");
		System.out.println("f)Fahrenheit to Kelvin.");
		System.out.print("Please enter your choice ==>");
		choice = scan.next().charAt(0);

		while (choice == 'a') {
			System.out.println((input / 5) * 9 + 32);
			break;
		}
		while (choice == 'b') {
			System.out.println((input - 32) * 5 / 9);
			break;
		}
		while (choice == 'c') {
			System.out.println(input - 273.15);

			break;
		}
		while (choice == 'd') {
			System.out.println(input + 273.15);
			break;
		}
		while (choice == 'e') {
			System.out.println((input - 273.5) * 9 / 5 + 32);
			break;
		}
		while (choice == 'f') {
			System.out.println((input + 459.67) * 5 / 9);
			break;
		}

	}

}

use while as if!!!!

By person, 2020-10-13 03:01:18
	public showOrHideLegends(seriesList: any[]) {
		if (seriesList.length === 0)
			return false;
		else
			return true;
	}

more code lines => more money; that's how our contractor company thinks

By Nitor, 2017-05-06 19:59:30
public enum DataSize {
    BYTE,
    DOUBLE_BYTE,
    INT,
    LONG;
    
    public boolean isEqualTo(Object value) {
        if(value instanceof Byte && this.equals(BYTE)) {
            return true;
        } else if ((value instanceof Character || value instanceof Short) && this.equals(DOUBLE_BYTE)) {
            return true;
        } else if ((value instanceof Integer) && this.equals(INT)) {
            return true;
        } else if ((value instanceof Long) && this.equals(LONG)) {
            return true;
        }
        return false;
    }
}
By DevHONK, 2021-02-22 15:21:03
if ((string)filtros[0] != "-1" && (string)filtros[0] != "0") 
    filtros[0] = (string)filtros[0] != "" ? filtros[0] : DBNull.Value;
    
else
    filtros[0] = DBNull.Value;  
By Anonymous, 2020-06-02 18:22:05
 foreach (Byte bajt in data ) {
                    BufferIndex = i++;
                    if (!char.IsControl((char)bajt))
                        MyCharacter = Convert.ToChar(bajt).ToString();//Encoding.ASCII.GetString(new[]{bajt});
                    else
                        MyCharacter = " ";

                    if (BufferIndex == 200)
                        {
                            int a = BufferIndex;
                        }

                    
                    if (BufferIndex < 200)
                    {
                        sw.WriteLine("PrintBuffer1[" + BufferIndex + "] :=\t" + bajt + "\t; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "\t" + MyCharacter );
                    }

                    if (BufferIndex >= 200 && BufferIndex  < 400)
                    {
                        BufferIndex = BufferIndex - 200;
                        sw.WriteLine("PrintBuffer2[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }
                    if (BufferIndex >= 400 && BufferIndex < 600)
                    {
                        BufferIndex = BufferIndex - 400;
                        sw.WriteLine("PrintBuffer3[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }
                    if (BufferIndex >= 600 && BufferIndex < 800)
                    {
                        BufferIndex = BufferIndex - 600;
                        sw.WriteLine("PrintBuffer4[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }
                    if (BufferIndex >= 800 && BufferIndex < 1000)
                    {
                        BufferIndex = BufferIndex - 800;
                        sw.WriteLine("PrintBuffer5[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }
                    if (BufferIndex >= 1000 && BufferIndex < 1200)
                    {
                        BufferIndex = BufferIndex - 1000;
                        sw.WriteLine("PrintBuffer6[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }
                    if (BufferIndex >= 1200 && BufferIndex < 1400)
                    {
	                        BufferIndex = BufferIndex - 1200;
                        sw.WriteLine("PrintBuffer7[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }
                    if (BufferIndex >= 1400 && BufferIndex < 1600)
                    {
                        BufferIndex = BufferIndex - 1400;
                        sw.WriteLine("PrintBuffer8[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }
                    if (BufferIndex >= 1600 && BufferIndex < 1800)
                    {
                        BufferIndex = BufferIndex - 1600;
                        sw.WriteLine("PrintBuffer9[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }
                    if (BufferIndex >= 1800 && BufferIndex < 2000)
                    {
                        BufferIndex = BufferIndex - 1800;
                        sw.WriteLine("PrintBuffer10[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }
                    if (BufferIndex >= 2000 && BufferIndex < 2200)
                    {
                        BufferIndex = BufferIndex - 2000;
                        sw.WriteLine("PrintBuffer11[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }
                    if (BufferIndex >= 2200 && BufferIndex < 2400)
                    {
                        BufferIndex = BufferIndex - 2200;
                        sw.WriteLine("PrintBuffer12[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "   " + MyCharacter);
                    }

                        
                }

don't repeat yourself.. whyy we don't have PrintBufeer[i] ?

By Anonymous, 2016-02-08 09:52:40
  <div ng-repeat="recipient in $ctrl.resource.invoiceRecipients track by $index">
    <div>
      {{$ctrl.resource.invoiceRecipients[$index]}}
    </div>
  </div>

You could easily use the "recipient" variable instead of getting it again from the array, is there a reason for doing this?

By Anonymous, 2020-10-29 16:26:16
if (baza[mCurrentIndex] == Boolean.TRUE) {
            if (mCurrentIndex != baza.length-1) {
                up();
                nextQuestion();
            }

            if (mCurrentIndex == baza.length) {
                WypiszWynik();
            }

        }

so you have an array of booleans and you're comparing it to Boolean.TRUE why

By pain, 2017-10-31 21:58:54
public static int maximum(int f, int g)
{
	try
	{
		int[] far = new int[f];
		far[g] = 1;
		return f;
	}
	catch(NegativeArraySizeException e)
	{
		f = -f;
		g = -g;
		return (-maximum(f, g) == -f)? -g : -f;
	}
	catch(IndexOutOfBoundsException e)
	{
		return (maximum(g, 0) == 0)? f : g;
	}
}
By Anonymous, 2019-10-18 06:03:41
if (string.Compare(json["result"].ToString(), "OK", true) == 0)
{
    if (string.Compare(json["list"][0]["result"].ToString(), "OK", true) == 0)
        return null;
        
    //omitted
}
By J@k3R, 2022-08-09 08:51:55
   // Test read access of memory
   try
   {
      c = ( (char*) pvMemory )[0];
      c = ( (char*) pvMemory )[iNLen - 1];
   }

   catch( ... ) {
      return -1;
   }
By Anonymous, 2022-10-19 16:28:05
outerloop:
try {
    if (selectedFile == null) {
        break outerloop;
    } else {
        if (selectedFile != null) {
            readTo = new PrintStream(selectedFile);
            readTo.println(userCodeInput.getText());
            readTo = readTheOptionsIntegers(readTo);
    }
} catch(IOException e) {
    System.out.println(e);
}
By Anonymous, 2017-12-13 09:39:37
    function changePassword() {
        if (isInputEmpty()) {
            $.ajax({
                type: 'POST',
                data: '...'
                url: '...',
                success: function (result) {
                    if (result.substring(0, 3) != "!!!") {
                        //success
                    } else {
                        //faliure
                    }
                },
                error: function () {
                    }
            });
        }
    }

And of course,in production, it always reported success and never changed the password, because of equally bad server code.

By You will be proud of our code!, 2017-12-15 11:30:02