Zum Inhalt springen
View in the app

A better way to browse. Learn more.

#T/N/X/T

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.

Gibt es switch(true)... in MQL4?

Geschrieben

Hallo,

grundsätzlich verwende ich gerne das Konstrukt:

switch (true)
{
case (a == b):
...
case (a == c):
... u.s.w.


Scheint es in Mql4 nict zu geben, richtig?

Gruss Kai

Bearbeitet von whipsaw
code tag eingefügt

Featured Replies

Geschrieben
  • Autor

 

Die Docu kannte ich. Und sie liest sich auch so, dass es nicht gehen dürfte:

 

"The constant expression can't contain variables or function calls. Expression of the switch operator must be of integer type."

Jetzt habe ich aber noch mal probiert und folgendes geht. Switch operator ist doch jetzt bool? Das es vorher nicht ging, lag an der Syntax. man muss die Variable jeweils in Hochkomma innerhalb der Klammer.

 

<code>

int a = 2;

int b = 3;

 

switch(true)

{

case ('a'=='b'):

Print("CASE A == B");

break;

case ('a'<='b'):

Print("CASE A <= B");

default:

Print("default");

break;

}

</code>

 

PS: Sorry, ich hab mir jetzt zum zweiten mal nen Wolf gesucht, wie die code-tags funktionieren. Ich finds nicht.

Gruss kai

Bearbeitet von kai700

Dein Kommentar

Du kannst jetzt schreiben und Dich später registrieren. Wenn Du ein Konto hast, melde Dich jetzt an, um unter Deinem Benutzernamen zu schreiben.

Gast
Auf dieses Thema antworten...

Account

Navigation

Suche

Suche

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.