Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Passing Enumerated Types to routine

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
victorf



Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York

Posted: 10 March 2006, 23:03 PM    Post subject: Passing Enumerated Types to routine Reply with quote

If I have an enumerated type such as:

Code:

Enum Pet
  Dog
  Bird
  Snake
End Enum

Dim p as Pet

  p.Snake = Boa
  Call Sub(p)

Public Sub (ByVal et as Pet)
  if et.Snake = Boa then
    do something
 end if

End Sub


Is the sub structured correctly Question

Any enlightenment will be appreciated. Smile

Vic
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 11 March 2006, 1:13 AM    Post subject: Reply with quote

Not quite. An enumerated type is defined by specifying the values that a variable of that enumerated type may assume. ( Beneath the covers, the compiler assigns numeric values to the members of the type unless you specify values explicitly but those values are largely immaterial.)
Code:
Enum Pet
  Dog
  Bird
  Snake
End Enum

Dim p as Pet

  p = Snake
  Call Sub(p)

Public Sub (ByVal et as Pet)
  if et = Snake then
    do something
 end if

End Sub
Back to top
victorf



Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York

Posted: 11 March 2006, 12:33 PM    Post subject: Reply with quote

Oh Exclamation I see. Thanks for clarifying this for me. Smile

Vic
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group