Forum Discussion

mixe's avatar
mixe
Visitor
14 years ago

brightscript 3.0 modulo

I'm having a bit of problem using MOD. I can't seem to workout what format this function should use. I have tried using mod(n,val) which just caused an error and n mod val didn't work either. I assumed as NOT uses the format not(val) then it would be the same for mod.

2 Replies

  • It's an operator(like "+", "-", "*", "/"), not a function. Try something like this:
    tick_count = 3
    if tick_count mod 3 = 0 then
    doSomethingHere
    end if
    Also I think you should be able to use 'NOT val'. The parentheses just indicate order of operation (e.g. "not(b>40)" first compares b to 40 then NOTS the result).

    /edit: Also see RenoJim's comment below.
  • renojim's avatar
    renojim
    Community Streaming Expert
    print 11 mod 3 works for me. Stupid question, but your firmware is v3.0 or above, right?

    -JT