Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Variable Type Shorthand

Author
Message
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 22nd Jun 2011 11:49
I never used shorthand, for variable types. And I feel like an idiot for asking, but what are they in Dark Basic?

foo$ = String, iirc
foo = Integer, iirc
foo# = Float, iirc

Are there anymore?
Thanks!
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 22nd Jun 2011 13:22
Those are it as far as I'm aware (I haven't seen any others).

A clever person solves a problem, a wise person avoids it - Albert Einstein
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 23rd Jun 2011 07:56
Oh ok!
What if I need to use other types when passing values in functions? I've been programming it in as 'pName$', for example. Would 'pName as String' work as well?
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 23rd Jun 2011 11:52
Quote: "Would 'pName as String' work as well? "

It would and you wouldn't need to ever use the dollar sign with it if it is declared that way. I declare all of my variables this way but you do have to remember which one is which type but DBPro is a very lenient language.

A clever person solves a problem, a wise person avoids it - Albert Einstein
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 24th Jun 2011 13:11
I find it's best to keep the suffix for variables even if you have declared them, mostly to help remember what variable is what type.

There is also a curious quirk in the way DBP does variable declaration that allows you to do stuff like this...



Hope that helps

Login to post a reply

Server time is: 2024-11-27 21:47:49
Your offset time is: 2024-11-27 21:47:49