IF/THEN STATEMENTS

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • IF/THEN STATEMENTS

    I was wondering if I could get a little help with if/then statements. I have used the yes/no statement and puts in C1 comment blah blah blah I have seen in programs already written a if /then statement below this but am clueless of how to insert this I have used F1 with little help
    Since I gave up hope I feel much better !!!

  • #2
    I use IF/GOTO statements and can post some code if that will help you? Let me know.
    PCDmis 3.5mr2 CAD++

    Comment


    • #3
      Originally posted by Ken379128
      I was wondering if I could get a little help with if/then statements. I have used the yes/no statement and puts in C1 comment blah blah blah I have seen in programs already written a if /then statement below this but am clueless of how to insert this I have used F1 with little help
      I'm sorry if the help file wan't of much help. If you have suggestions on how it could be improved, please let me know.

      There is more than one way to insert an IF statement, but the quickest is probably to go to Command mode where you want it to be and type IF and press TAB. This will put some code that looks like this:

      IF/0
      END_IF/


      Then you can highlight the 0 and type a condition to test for.

      For example,
      C1 =COMMENT/YESNO,NO,Do you love PC-DMIS?
      IF/C1.INPUT=="YES"
      COMMENT/OPER,NO,"I LOVE PC-DMIS."
      END_IF/


      So, if the input of the C1 comment matches "YES", it will execute the statements inside the IF command block. If not, they get skipped.

      Good luck,
      Jared Hess - PC-DMIS Documentation Team Lead @ HMI
      [View 2008 Reporting Tutorials Here]

      Comment


      • #4
        Question for Jared

        Originally posted by JaredHess
        ......Then you can highlight the 0 and type a condition to test for.

        For example,
        C1 =COMMENT/YESNO,NO,Do you love PC-DMIS?
        IF/C1.INPUT=="YES"
        COMMENT/OPER,NO,"I LOVE PC-DMIS."
        END_IF/


        So, if the input of the C1 comment matches "YES", it will execute the statements inside the IF command block. If not, they get skipped.

        Good luck,
        Who is going to click yes? JK (you asked for it)

        I was wondering something on the IF/GOTO statements as I do not know how PCDMIS compiles for execution. Should we be in the same camp as Basic and C where IF/GOTO should be avoided unless absolutely necessary? PCDMIS programs are much shorter and smaller than most Applications that one writes in Basic or C (not to mention linear vs event driven) so I was not sure if convention-wise we should try our best to only use it when other options don't exist or are cumbersome. I don't use it because there is usually a solution that is easier for me to keep track of layout wise but what say you?

        Craig

        BTW thanks for posting here it does mean a lot to us.
        <internet bumper sticker goes here>

        Comment


        • #5
          Originally posted by craiger_ny
          I was wondering something on the IF/GOTO statements as I do not know how PCDMIS compiles for execution. Should we be in the same camp as Basic and C where IF/GOTO should be avoided unless absolutely necessary? PCDMIS programs are much shorter and smaller than most Applications that one writes in Basic or C (not to mention linear vs event driven) so I was not sure if convention-wise we should try our best to only use it when other options don't exist or are cumbersome. I don't use it because there is usually a solution that is easier for me to keep track of layout wise but what say you?

          Craig

          BTW thanks for posting here it does mean a lot to us.
          Well, I don't really know. It's probably a matter of personal preference with something like PC-DMIS. Sure, general programming conventions say to avoid jumping around to different labels. But then, I'm not a true programmer, just picked up stuff as I went.

          I confess that in some of my VBA scripts, I have used labels when I couldn't get my right-brained mind (I'm an English Major) to figure out a different solution.

          Ultimately, my personal view is to use what method works best for you, as long as it gets the job done.
          Last edited by JaredHess; 07-21-2006, 01:56 PM.
          Jared Hess - PC-DMIS Documentation Team Lead @ HMI
          [View 2008 Reporting Tutorials Here]

          Comment


          • #6
            Ken, you can always go the more user friendly way of F9'ing the IF/THEN code. A setup type window will pop and you can find your variables etc there.
            I used to be high on life but I built up a tolerance.

            Brown & Sharpe Global Advantage
            PCDMIS CAD++ v2011mr2
            PH10MQ/SP600M


            sigpic

            Comment


            • #7
              I tried the F9 but in the example given I get the 1st line everything after that was not going good of course I did not have much time to play around today, I hate busy Fridays. Thanks for the help
              Since I gave up hope I feel much better !!!

              Comment

              Related Topics

              Collapse

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