Variable and Operator

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #9935 quote
    Paulmelb
    Participant
    New

    Hi,

     

    Is it possible to use a variable to return an operator (or also a string).  Example of part of code below:

    IF opVar = 1 THEN
    myOperator = > 
    ELSIF opVar = 2 THEN
    myOperator = <
    
    ENDIF

    For this opVAR would be a variable set in ‘Variable optimization’ and myOperator could be used elsewhere in the code where I wanted to check different results based on less than or greater than.

    Thanks

    #9941 quote
    grizzly
    Participant
    Average

    Hi Paul
    Great question – math operators can’t be used as variables.

    You could try and code the conditions to +1 or -1 from the myoperator variable based on prior conditions and take it from there. If that makes sense.

    Cheers

    Nicolas thanked this post
    #9980 quote
    Paulmelb
    Participant
    New

    Thanks grizzly… yep, will rewrite code and use conditions as you mentioned.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Variable and Operator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Paulmelb @paulmelb Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Paulmelb
9 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/28/2016
Status: Active
Attachments: No files
Logo Logo
Loading...