kryton9
12-12-2006, 06:29
Guys, I did a test to see if this would work, and glad it does. I am using some ideas from php and dark basic pro. Well in php all the variables have the $
and in DarkBasic Pro a common way to identify float variables is with a #. I think this idea of identifying the type of variable with the variable name and symbol is nice, however the way it is in c, I don't care for as it is in the front of the variable there are so many types.
The idea here is $ would be at the end of string variables, the # at the end of float variables and variables without any symbol are integers.
Also I was thinking for subs it would be
CapFirstLetter and no () it is a subroutine.
CapsFirstLetter() with () means it is a function
capFirstLetter would be an integer variable
capFirstLetter$ a string
capFirstLetter# a float
%capFirstLetter is a constant
What do you guys think? If you have any other ideas would like to read them here.
USES "CONSOLE"
dim float# as double = 123.45
dim s$ as string = "Thin Basic"
dim i as integer = 5
Console_Write( "the float value is " & Str$(float#) & $CRLF)
Console_Write( "the string value is " & s$ & $CRLF)
Console_Write( "the integer value is " & Str$(i) & $CRLF & $CRLF)
Console_Write( "Any Key to Exit" & $CRLF)
Console_WaitKey
and in DarkBasic Pro a common way to identify float variables is with a #. I think this idea of identifying the type of variable with the variable name and symbol is nice, however the way it is in c, I don't care for as it is in the front of the variable there are so many types.
The idea here is $ would be at the end of string variables, the # at the end of float variables and variables without any symbol are integers.
Also I was thinking for subs it would be
CapFirstLetter and no () it is a subroutine.
CapsFirstLetter() with () means it is a function
capFirstLetter would be an integer variable
capFirstLetter$ a string
capFirstLetter# a float
%capFirstLetter is a constant
What do you guys think? If you have any other ideas would like to read them here.
USES "CONSOLE"
dim float# as double = 123.45
dim s$ as string = "Thin Basic"
dim i as integer = 5
Console_Write( "the float value is " & Str$(float#) & $CRLF)
Console_Write( "the string value is " & s$ & $CRLF)
Console_Write( "the integer value is " & Str$(i) & $CRLF & $CRLF)
Console_Write( "Any Key to Exit" & $CRLF)
Console_WaitKey