Shop OBEX P1 Docs P2 Docs Learn Events
Boolean issue or assignment issue? — Parallax Forums

Boolean issue or assignment issue?

R PankauR Pankau Posts: 127
edited 2012-11-25 18:18 in Propeller 1
Maybe this is just a quiz that I've failed.

why would this:
if (price_filled_flags == $3FFFFFF) AND  ( max_price >= Prices[25])

        OUTA[_AC_RELAY] := _ON 
        OUTA[_FAN_RELAY] := _ON 
        waitcnt(clkfreq/100 + cnt)  
        OUTA[_FAN_RELAY] := (_OFF | force_relay2)
        
        IF debug_flag == 1 
          PST.str(string("Relay ON max = "))
          PST.dec(max_price)
          PST.char(13)

cause the variable max_price to result in -1 (true)
but this:
if (price_filled_flags == $3FFFFFF) AND  ( max_price > Prices[25])

        OUTA[_AC_RELAY] := _ON 
        OUTA[_FAN_RELAY] := _ON 
        waitcnt(clkfreq/100 + cnt)  
        OUTA[_FAN_RELAY] := (_OFF | force_relay2)
        
        IF debug_flag == 1 
          PST.str(string("Relay ON max = "))
          PST.dec(max_price)
          PST.char(13) 

works as expected without modifying max_price?
correct me if I'm wrong but >= is not assignment right?

Comments

  • R PankauR Pankau Posts: 127
    edited 2012-11-25 18:10
    maybe it's a "promotion" thing?
    looking at Boolean AND in the prop manual
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-11-25 18:11
    R Pankau wrote: »
    correct me if I'm wrong but >= is not assignment right?

    Wrong. You want "=>". Just about any operator ending with "=" is an assignment.
  • R PankauR Pankau Posts: 127
    edited 2012-11-25 18:18
    that'll do it.
    I was thinking left = was assignment.
Sign In or Register to comment.