Page 1 of 1
Something wrong with this code?
Posted: Mon Oct 28, 2013 11:49 am
by chris25
There appears to be a mess in this code, but I am not sure what it is. Firstly the Get is a command and should not have an underscore after it joining it to another word. the variables are not written correctly; should be t or g prefixed. The code does not work as expected. "initialise and 'display' and 'calculate' are not in the dictionary yet they are placed as commands.
I just need to know whether to carry on with this pdf tutorial, or whether I have incorrectly misinterpreted the above.
Chris
Re: Something wrong with this code?
Posted: Mon Oct 28, 2013 12:10 pm
by bangkok
Since you have declared all variables as global variables, at the top of your script... why do you reuse the same var names as parameters, for each command ?
No need.
Re: Something wrong with this code?
Posted: Mon Oct 28, 2013 1:08 pm
by chris25
Hi, I did not, this is a tutorial, and I was getting confused (as a beginner - complete novice); yet I felt there was somethings not quite accurate but could not be concrete about it. So thankyou for that input - much appreciated.
Re: Something wrong with this code?
Posted: Mon Oct 28, 2013 4:25 pm
by Klaus
Hi Chris,
chris25 wrote:Firstly the Get is a command and should not have an underscore after it joining it to another word.
True, but this is a custom handler named "get_whatever_..." and NOT the actual "GET" command!
chris25 wrote:the variables are not written correctly; should be t or g prefixed.
Well, there are no STRICT rules on how to name variables, so this is all correct!
But yes, using meaningful prefixes would be good style
chris25 wrote:The code does not work as expected.
Sure? Sorry, did not try it...
chris25 wrote:"initialise and 'display' and 'calculate' are not in the dictionary yet they are placed as commands.
These, too, are custom handlers and thus they do not appear in the LC dictionary!
Hope that helps!
Best
Klaus
Re: Something wrong with this code?
Posted: Mon Oct 28, 2013 7:30 pm
by chris25
Hallo Klaus, thankyou, you have cleared things up, now due to this I think then he must have pre-prepared stacks for his students with extra code written in, so this explains a lot. Thankyou for clarifying about the custom handlers, was just reading about this earlier, but did not recognise them here - silly me.