jeudi 30 janvier 2020

How to do multiple if without nested if

            if (jamholderku.equals("1")){
                params.put("sesi1", jamholderku);
            }else {
                params.put("sesi1", jamholder);
            }

            if (jamholderku2.equals("1")){
                params.put("sesi2", jamholderku2);
            }else {
                params.put("sesi2", jamholder2);
            }

            if (jamholderku3.equals("1")){
                params.put("sesi3", jamholderku3);
            }else {
                params.put("sesi3", jamholder3);
                Log.d("paramskutes", jamholder3);
            }

            if (jamholderku4.equals("1")){
                params.put("sesi4", jamholderku4);
            }else {
                params.put("sesi4", jamholder4);
            }

            if (jamholderku2_1.equals("1")){
                params.put("sesi2_1", jamholderku2_1);
            }else {
                params.put("sesi2_1", jamholder2_1);
            }

            if (jamholderku2_2.equals("1")){
                params.put("sesi2_2", jamholderku2_2);
            }else {
                params.put("sesi2_2", jamholder2_2);
            }

            if (jamholderku2_3.equals("1")){
                params.put("sesi3", jamholderku2_3);
            }else {
                params.put("sesi3", jamholder2_3);
            }

            if (jamholderku2_4.equals("1")){
                params.put("sesi4", jamholderku2_4);
            }else {
                params.put("sesi4", jamholder2_4);
            }

            if (jamholderku3_1.equals("1")){
                params.put("sesi2_1", jamholderku3_1);
            }else {
                params.put("sesi2_1", jamholder3_1);
            }

            if (jamholderku3_2.equals("1")){
                params.put("sesi2_2", jamholderku3_2);
            }else {
                params.put("sesi2_2", jamholder3_2);
            }

            if (jamholderku3_3.equals("1")){
                params.put("sesi3", jamholderku3_3);
            }else {
                params.put("sesi3", jamholder3_3);
            }

            if (jamholderku3_4.equals("1")){
                params.put("sesi4", jamholderku3_4);
            }else {
                params.put("sesi4", jamholder3_4);
            }

            if (jamholderku4_1.equals("1")){
                params.put("sesi2_1", jamholderku4_1);
            }else {
                params.put("sesi2_1", jamholder4_1);
            }

            if (jamholderku4_2.equals("1")){
                params.put("sesi2_2", jamholderku4_2);
            }else {
                params.put("sesi2_2", jamholder4_2);
            }

            if (jamholderku4_3.equals("1")){
                params.put("sesi3", jamholderku4_3);
            }else {
                params.put("sesi3", jamholder4_3);
            }

            if (jamholderku4_4.equals("1")){
                params.put("sesi4", jamholderku4_4);
            }else {
                params.put("sesi4", jamholder4_4);
            }
            return params;

when the first if statement right it will not execute other if statement EX: if (jamholderku.equals("1)) == True then it will execute params.put(blablabla) but it won't execute other if statement like if (jamholderku2.equals("1")) but if it executing if (jamholderku2.equals("1")) it won't execute if (jamholderku3.equals("1")) even if it was true can you please help me? because it deadline was due temorrow, i need to submit it or i get kicked from my team

Aucun commentaire:

Enregistrer un commentaire