CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2009
    Posts
    3

    Question Time Condition statement

    Hi Guru's,

    Can somebody help me to understand what the following conditional statement means:

    if (hour==0 and minute==0 and sec==10) then ....

    Thanks.

  2. #2
    Join Date
    Dec 2008
    Posts
    144

    Re: Time Condition statement

    Quote Originally Posted by raj_072 View Post
    if (hour==0 and minute==0 and sec==10) then ....
    What is the language? I guess it isn't C++ because of then.
    Obviously it means that the hour equals 0, the minute equals 0 and the sec equals 0.

  3. #3
    Join Date
    Oct 2009
    Posts
    3

    Re: Time Condition statement

    the original conditional statement is

    sec==10 and minute==0 and hour==0 ? H2S_Kamin1und2:fSum[hist 1]+ifinvalid(H2S_Kamin1und2,0)

    Apart from the condition part the rest statement is clear to me.

  4. #4
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Time Condition statement

    Still not C++ since C++ doesn't use 'and'

    if you meant && instead of 'and'

    then what's here is a terniary operation

    which basically means.

    <condition> ? <execute this when condition is true> : <execute this when condition is false>

    the condition itself seems to test if the time (hour/minute/sec) is 10 seconds past midnight.

  5. #5
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Time Condition statement

    Maybe it's a time internal, and not a time. In this case it could mean that exactly 10 seconds have passed since some event. It all depends on the context.

    As for 'and', one can do:
    Code:
    #define and &&
    and then user it like that. But I guess the line is not correct.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured