Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

For-Schleife

Empfohlene Antworten

Veröffentlicht

Entweder bin ich zu doof dazu, oder ich hab keine Ahnung . . .

Wie bekomme ich das:

switch (von>=0, von<=9, von++)

                {

                    case von==0:                       

                        case bis==0:

                        alert("0");

                        break;


                        case bis==1:

                        alert("0");

                        alert("1");

                        break;


                        case bis==2:

                        alert("0");

                        alert("1");

                        alert("2");

                        break;


                        case bis==3:

                        alert("0");

                        alert("1");

                        alert("2");

                        alert("3");

                        break;


                        case bis==4:

                        alert("0");

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        break;


                        case bis==5:

                        alert("0");

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        break;


                        case bis==6:

                        alert("0");

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        break;


                        case bis==7:

                        alert("0");

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        alert("7");

                        break;


                        case bis==8:

                        alert("0");

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        alert("7");

                        alert("8");

                        break;


                        case bis==9:

                        alert("0");

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        alert("7");

                        alert("8");

                        alert("9");

                        break;                                               

                    break;


                    case von==1:

                        case bis==1:

                        alert("1");

                        break;


                        case bis==2:

                        alert("1");

                        alert("2");

                        break;


                        case bis==3:

                        alert("1");

                        alert("2");

                        alert("3");

                        break;


                        case bis==4:

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        break;


                        case bis==5:

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        break;


                        case bis==6:

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        break;


                        case bis==7:

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        alert("7");

                        break;


                        case bis==8:

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        alert("7");

                        alert("8");

                        break;


                        case bis==9:

                        alert("1");

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        alert("7");

                        alert("8");

                        alert("9");

                        break;

                    break;


                    case von==2:

                        case bis==2:

                        alert("2");

                        break;


                        case bis==3:

                        alert("2");

                        alert("3");

                        break;


                        case bis==4:

                        alert("2");

                        alert("3");

                        alert("4");

                        break;


                        case bis==5:

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        break;


                        case bis==6:

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        break;


                        case bis==7:

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        alert("7");

                        break;


                        case bis==8:

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        alert("7");

                        alert("8");

                        break;


                        case bis==9:

                        alert("2");

                        alert("3");

                        alert("4");

                        alert("5");

                        alert("6");

                        alert("7");

                        alert("8");

                        alert("9");

                        break;

                    break;


                    . . . . . . . . usw

in eine For-Schleife?? Das sind so Texteingaben, wo man für VON und BIS jeweils eine Zahl eingeben muss . . .

Der Code in dieser Form ist meiner Meinung nach unbrauchbar.

Dabei gehe ich davon aus das "bis" vorgegeben ist. Deine Verwendung von "von" ist mir zwar auch im switch teil nicht ganz klar...

Aber ich versuch einfachmal zu schreiben was du logisch meinen könntest:


for(int aktZahl = von; aktZahl <= bis; aktZahl++) {

  alert(int_to_string..(aktZahl));

}

So meinte ich es :)

for (iCnt=v; iCnt<=b; iCnt++)

     {

          alert(iCnt);

     }

v ist dann VON und b ist BIS.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.