Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9574 > unrolled thread
| Started by | Jesse Perla <jesseperla@gmail.com> |
|---|---|
| First post | 2012-04-12 08:44 +0000 |
| Last post | 2012-04-13 08:58 +0000 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
What characters are allowed in mathematica variable names? i.e. how Jesse Perla <jesseperla@gmail.com> - 2012-04-12 08:44 +0000
Re: What characters are allowed in mathematica variable names? i.e. how Yi Wang <tririverwangyi@gmail.com> - 2012-04-13 08:54 +0000
Re: What characters are allowed in mathematica variable names? i.e. how David Reiss <dbreiss@gmail.com> - 2012-04-13 08:55 +0000
Re: What characters are allowed in mathematica variable names? i.e. how Ray Koopman <koopman@sfu.ca> - 2012-04-13 08:58 +0000
| From | Jesse Perla <jesseperla@gmail.com> |
|---|---|
| Date | 2012-04-12 08:44 +0000 |
| Subject | What characters are allowed in mathematica variable names? i.e. how |
| Message-ID | <jm64l6$6lq$1@smc.vnet.net> |
In other languages like C++, _ is a kosher character to be in variable names. It is not in mathematica, so things like "my_first_variable" don't work. I have been using a ` to separate out the words to get things like my`first`variable, but now realize it is creating other issues due to the scoping it introduces. Are there are other characters I can use to separate out words in variable names? Thanks
[toc] | [next] | [standalone]
| From | Yi Wang <tririverwangyi@gmail.com> |
|---|---|
| Date | 2012-04-13 08:54 +0000 |
| Message-ID | <jm8pjo$iur$1@smc.vnet.net> |
| In reply to | #9574 |
It's an interesting question. I also tried to find the answer. The only character that I found is $. Say you can write my$first$variable. But anyway I am more used to myFirstVariable than $. Best, Yi On Thursday, April 12, 2012 4:44:22 AM UTC-4, Jesse Perla wrote: > In other languages like C++, _ is a kosher character to be in variable names. It is not in mathematica, so things like "my_first_variable" don't work. I have been using a ` to separate out the words to get things like my` first`variable, but now realize it is creating other issues due to the scoping it introduces. > > Are there are other characters I can use to separate out words in variable names? > > Thanks
[toc] | [prev] | [next] | [standalone]
| From | David Reiss <dbreiss@gmail.com> |
|---|---|
| Date | 2012-04-13 08:55 +0000 |
| Subject | Re: What characters are allowed in mathematica variable names? i.e. how |
| Message-ID | <jm8pmk$j0g$1@smc.vnet.net> |
| In reply to | #9574 |
For your main issue -- how to make your variables readable -- simply use camel case: I.e., myFirstVariable or MyFirstVariable. However, remember that Mathematica uses camel case for all of its parameters, with the key convention that all of them begin with a capital character. So, if you begin yours with a lowercase character you will not encounter name conflicts. If you do start with an Uppercase character then you need to be careful that you are not encountering such conflicts. --David On Apr 12, 4:44 am, Jesse Perla <jessepe...@gmail.com> wrote: > In other languages like C++, _ is a kosher character to be in variable names. It is not in mathematica, so things like "my_first_variable" don't work. I have been using a ` to separate out the words to get things like my`first`variable, but now realize it is creating other issues due to the scoping it introduces. > > Are there are other characters I can use to separate out words in variable names? > > Thanks
[toc] | [prev] | [next] | [standalone]
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2012-04-13 08:58 +0000 |
| Subject | Re: What characters are allowed in mathematica variable names? i.e. how |
| Message-ID | <jm8prd$j2n$1@smc.vnet.net> |
| In reply to | #9574 |
On Apr 12, 1:44 am, Jesse Perla <jessepe...@gmail.com> wrote: > In other languages like C++, _ is a kosher character to be > in variable names. It is not in mathematica, so things like > "my_first_variable" don't work. I have been using a ` to separate > out the words to get things like my`first`variable, but now realize > it is creating other issues due to the scoping it introduces. > > Are there are other characters I can use to separate out words > in variable names? No. The "solution" is camelCase: in multiWordNames, capitalize the initial letter of each word except the first. (If you capitalize the initial letter of the first word too then your name may conflict with a built-in symbol.)
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web