If Var in [x...y]

Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2078
Registered: 03 / 2003
Subject:

If Var in [x...y]

 · 
Posted: 19.05.2019 - 14:42  ·  #1
Hallo Rolf,

wieso geht das nicht:
Code
If YPos not in [0..127] then .... 


Muß ich hier echt mit
Code
If ((YPos<0) or (YPos>127)) then ....

arbeiten?

Oder hab ich einen Denkfehler?

Gruss
Harry
TheBeginner
Schreiberling
Avatar
Gender: n/a
Location: Wunsiedel Bayern
Age: 66
Posts: 755
Registered: 06 / 2013
Subject:

Re: If Var in [x...y]

 · 
Posted: 19.05.2019 - 16:05  ·  #2
Also bei mir gehts

Code

  Ypos:= 44;
  if not (YPos in [0..127])  then
    pwm_mosfet:= 40;
  endif;

Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2078
Registered: 03 / 2003
Subject:

Re: If Var in [x...y]

 · 
Posted: 19.05.2019 - 17:02  ·  #3
Hallo Frank,

ok danke, also ein Denkfehler ..... klar das "not" muß natürlich nach dem "If" stehen :wall:

Gruss
Harry
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: If Var in [x...y]

 · 
Posted: 19.05.2019 - 18:17  ·  #4
nach dem not muss ein boolean kommen un YPos ist ja ein byte oder word.
Der Begriff muss also ein bool ergeben, deshalb den Bgeriff klammern.
rolf
Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2078
Registered: 03 / 2003
Subject:

Re: If Var in [x...y]

 · 
Posted: 19.05.2019 - 18:32  ·  #5
Nein das not stand an der falschen Stelle.
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   93   107 · Page-Gen-Time: 0.020189s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI