Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Posts
    7

    Huh? Why doesn't my 'if/else' statement work?

    I am simply trying to display a message with the users operating system name in it. Using 'if' on it's own works fine but when I add 'else' it doesn't.
    Can anyone show me a better way or explain why 'else' isn't working.

    This works:

    Code:
    osresult = System.GetOSName();
    if osresult == "Windows XP" then
    Dialog.Message("Your OS is..", osresult);
    end
    This doesn't:

    Code:
    osresult = System.GetOSName();
    if osresult == "Windows XP" then
    Dialog.Message("Your OS is..", osresult);
    else
    if osresult == "Windows 2000" then
    Dialog.Message("Your OS is..", osresult);
    end
    I know its easier to just use:

    Code:
    osresult = System.GetOSName();
    Dialog.Message("Your OS is..", osresult);
    end
    but I am just testing a few things and my final code will not display the operating system but I just need to know why my 'else' steatement isnt working.

    Thanks

  2. #2
    Join Date
    Sep 2004
    Posts
    60
    this code by itself will not compile

    Code:
    osresult = System.GetOSName();
    if osresult == "Windows XP" then
    Dialog.Message("Your OS is..", osresult);
    else
    if osresult == "Windows 2000" then
    Dialog.Message("Your OS is..", osresult);
    end
    this will

    Code:
    osresult = System.GetOSName();
    if osresult == "Windows XP" then
    Dialog.Message("Your OS is..", osresult);
    elseif osresult == "Windows 2000" then
    Dialog.Message("Your OS is..", osresult);
    end

  3. #3
    Join Date
    Feb 2005
    Posts
    7
    Absynthe thank you.

    That works great. I tried finding it in the help files but couldn't, just a little space that caused the problem, oh well. Thanks again.

Similar Threads

  1. IF Statement layout
    By Sooty in forum Setup Factory 6.0
    Replies: 0
    Last Post: 10-19-2004, 06:39 AM
  2. WHILE loop inside a IF/ENDIF statement???? Bug??
    By TJ_Tigger in forum AutoPlay Media Studio 4.0
    Replies: 2
    Last Post: 04-27-2003, 07:49 PM
  3. How do I add to my PATH statement at install?
    By Tnygaard in forum Setup Factory 6.0
    Replies: 3
    Last Post: 05-27-2002, 01:38 AM
  4. WinNT and %AppDrv% doesn't work! Help please.
    By hawkeye in forum Setup Factory 5.0
    Replies: 3
    Last Post: 07-24-2000, 09:20 PM

Posting Permissions

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