Computer Science Canada variable type change |
Author: | mat [ Sun Apr 10, 2005 6:03 pm ] |
Post subject: | variable type change |
how do i change variable types? ie real to an int thanks |
Author: | jamonathin [ Sun Apr 10, 2005 6:09 pm ] | ||||
Post subject: | |||||
Easy. Use a round command.
But if you just round r, it still cannot be used as an integer.
strint / intstr = changing strings and integers realstr / strreal = changing string and reals. There are also more options for realstr, but that one's basic. Look up frealstr and erealstr in F10 help. |
Author: | mat [ Sun Apr 10, 2005 6:21 pm ] |
Post subject: | |
i think i needed to give more detail... How would i add a rounded real number to an int variable that already exists? basicly, could i switch the real to an int (not rounding) so i could add it to other ints? is there a command for real to int like there is for string to int (strint) ?erealint, or something? that does not work. thanks again, |
Author: | jamonathin [ Sun Apr 10, 2005 6:41 pm ] | ||||
Post subject: | |||||
You do a '+' sign? Works.
Doesn't Work.
As long as the real number is whole, it can be added to an integer. There's no way to actually chane the real to an integer, but you can round the real number and make a new integer variable equal to that real number. |
Author: | Drakain Zeil [ Sun Apr 10, 2005 6:53 pm ] |
Post subject: | |
intreal realint strint intstr and I think there's some others. |
Author: | jamonathin [ Sun Apr 10, 2005 7:34 pm ] | ||
Post subject: | |||
Drakain Zeil wrote: intreal
realint strint intstr and I think there's some others. intreal? realint? lol... it's called
those don't exist, mainly because there's no point ![]() |