Skip to Content
author's profile photo Former Member
Former Member

Declare constant dynamically

Hi all

Is there any way to declare a constant ,dynamically (ie base on a condition).

Regards

Prabumanoharan

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 27, 2008 at 06:04 AM

    why do you want to use a constant for this purpose....a constant would mean it will have a single value. So whatever be the condition , the value of the constant will not change.

    based on your condition, you can work with a normal variable and change its value. Or, you can declare multiple constants and use the appropriate one based on your condition.

    if this does not answer your question...can u pls explain the requirement in more detail in terms of what you want to do?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 27, 2008 at 06:05 AM

    no you can not...

    if you were able to set CONSTANT values dynamically then it would not make any sense of creating a constant... you can directly use a Variable

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 27, 2008 at 06:40 AM

    A constant is a constant is a constant.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 27, 2008 at 06:42 AM

    Hi

    You can not change the Constant's value dynamically.

    Instead you define a variable, multiple constants.

    And then based on your condition you can dynamically assign the value to that variable

    Thnkas & Regards

    Mallikharjuna Reddy

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2008 at 06:20 AM

    dropped

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.