|
-
Aug 27th, 2000, 07:58 PM
#1
Why is x the most used variable in both programming and algebra?
-
Aug 27th, 2000, 08:02 PM
#2
Hyperactive Member
Its the X-factor... That which is unknown.
X marks the spot.
-
Aug 27th, 2000, 08:06 PM
#3
X usually means something is unknown.
-
Aug 27th, 2000, 08:14 PM
#4
x is good for maths but
If you have a calculation like
Code:
x = x + variableamt.
Fine, but it should not be used where a more meaningful variable name could be used e.g
Code:
totSales = totSales + Sale_Qty
CustName = CustName & " " & Last_Name
Just pointing out the relative merits of naming variables. We do allow "x" etc to be used as For...Next counters etc.
My $0.01c worth.
-
Aug 27th, 2000, 08:16 PM
#5
Hyperactive Member
Jethro,
No we don't allow "x" in For...Next loops...
We use "iNum" or "iCount" or "iLoop" instead.
-
Aug 27th, 2000, 08:29 PM
#6
Most of the time I use i in For...Next loops, so I dont have to use a long variable name, but when I am doing something else, like assigning a variable to a string(or is it the other way around ) I use things like strMyRelavantVarName.
-
Aug 27th, 2000, 08:35 PM
#7
Hyperactive Member
Why add an entire 3 letters? (ie str)
Why not just add 1 letter? (s)
sMyRelevantStringName
iMyIntegerName
lMyLongName
oMyObject
dMyDate
I usually only go to 3 letter when defining form items :
frmFormName
txtTextBox
lstListBox
cboComboBox
fraFrame
-
Aug 27th, 2000, 09:13 PM
#8
well, usually when I use strings, I dont use str usually I just have the variable name. But for stuff like long I use lng, thanks for the tip(only using 1 letter), I have seen that used before, but was too lazy to ummmm.... too lazy to type the rest of this post, but anyway thanks.
-
Aug 27th, 2000, 09:21 PM
#9
Personally I use the following hungerian notation:
s = String
i = Integer
lng = Long, I don't use l because it's easy to confuse with a capital i (Which I use for interface classes)
sng = Single, as stated above I already use s for strings
b = Byte
bln = Boolean, I use b for Byte
d = Date
dbl = Double
-
Aug 27th, 2000, 09:44 PM
#10
_______
<?>
Simple Matthew:
Programming!
We've all been programed via school etc. Why is a chair a chair and not a table? Someone, way down the chain said it was a chair and so it is, because it's been handed down.
For example:
Right now everyone is taught to make their programs simulate MS as that is the way it should be done..ie..Shortcut = Ctrl X for exit. They say we should do it that way because everyone is already familuar with that context and so we do.....did you ever use Ctrl E for exit...I don't think so...and if you did it was a one time thing.
Programming...all our lives we are being programmed!
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 28th, 2000, 03:37 AM
#11
transcendental analytic
Default variables
Used with your own code you could have some variables that you always use for a specific purpose:
x,y,z - coordinates
x,temp - temporary values
w,h,dX, dY, dz... - dimensions, differences
ff - filenumber
alfa, beta - angles
a1, x1 - indexed
vx, vy - velocities
vr - vectors
n,s - counters in loops
newvalue - last argument in property let
and a lot more
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 28th, 2000, 10:03 AM
#12
Originally posted by Joacim Andersson
Personally I use the following hungerian notation:
s = String
i = Integer
lng = Long, I don't use l because it's easy to confuse with a capital i (Which I use for interface classes)
sng = Single, as stated above I already use s for strings
b = Byte
bln = Boolean, I use b for Byte
d = Date
dbl = Double
Mine is as follows.
- String: sVar
Integer: iVar
Long: lVar, dwVar (dw represents DWORD)
Handle: hVar
Boolean: bVar
Byte: chVar, cVar (c represents the C++ eqv. Char)
Date: dtVar
Single: sngVar
Double: dblVar
Currency: curVar
Double: dblVar
-
Aug 28th, 2000, 10:37 AM
#13
this is what I have been using.
Code:
Integer = iVar
Long = lngVar
Double = dblVar
Boolean = blnVar
Byte = bVar
Currency = curVar
Date = dtVar
Object = objVar
String = strVar
hWnd = hwndVar
Region = rgnVar
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|