Announcement

Collapse
No announcement yet.

Defining variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Robert E. Carneal
    replied
    Originally posted by Paul Dixon View Post
    Robert,
    have you tried writing a program to change that value?

    Code:
    %LoGre = 2
    %LoGre = 1
    
    PRINT %LoGre = 2
    %LoGre = 2
    is an equate which can only be set once in your program never to be changed. The program won't compile if you have a second assignment to the same equate.

    Paul.
    First question about writing a program to change the value? Yes. (Well, something else must have been wrong, and I am extremely sorry I did not preserve that routine to try it again.) I resolved it by not using the "%" and just searching the entire file to make sure I did not assign a new value to it.

    Second comment. You are right. It does not compile! Which is good for me!

    Thanks, everyone.

    Robert

    Leave a comment:


  • Paul Dixon
    replied
    Robert,
    have you tried writing a program to change that value?

    Code:
    %LoGre = 2
    %LoGre = 1
    
    PRINT %LoGre = 2
    %LoGre = 2
    is an equate which can only be set once in your program never to be changed. The program won't compile if you have a second assignment to the same equate.

    Paul.

    Leave a comment:


  • Carlo Pagani
    replied
    I suppose you could post a request to support.
    We have STATIC, GLOBAL, LOCAL variables

    You should request a CMOS type. That would only be allowed to be set once and never again

    Leave a comment:


  • Robert E. Carneal
    started a topic Defining variables

    Defining variables

    I am attempting to define several variables at the beginning of a program that I do NOT want its value changed anywhere else in the program any time for any reason. In fact, I'd just as soon it give an error if its value changed.

    Suppose I have:
    %LoGre = 2

    And later by accident I change it to:
    If NameFail=0 then
    LoGre=0
    End if


    I would be perfectly happy to have the program give me an error right then and there, and just come to an end. Can the variables be 'frozen' to certain values I give it?

    Another way to look at it. If the value for "Pi" was 3.14159, most of us wouldn't want the program to change Pi somewhere unexpectedly.

    Thanks.

    Robert
Working...
X
😀
🥰
🤢
😎
😡
👍
👎