Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Inline If

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,66297
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Inline If
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Inline If - 11/12/2008 4:54:45 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
If you've used VB.Net you've heard of this Function. Here's a dirty implementation for VBScript:


      

Example Use:

Lets say I want an array that contains the days of the month for all the months for an entire year. I would obviously need to know if its a leap year or not, so I could write it something like this:

Dim MonthDays : MonthDays = Array(31, IIf(IsLeapYear(Year), 29, 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)

This assumes you have an IsLeapYear function, but you get the point.

< Message edited by TNO -- 11/12/2008 5:07:46 AM >


_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch
 
 
Revisions: 1 | Post #: 1
 
 RE: Inline If - 11/20/2008 5:22:06 PM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Actually, that reminds a lot of the excel function

      

I never thought of integrating that kind of functionality into vbs, in an 'inline' sorta way.
Cool!

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to TNO)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Inline If Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts