PDA

View Full Version : Explain parameter and arguments


justmyway2
04-11-2017, 03:57 PM
Hello all,

Would someone be able to explain parameter and arguments to someone that had no coding background? I have been struggling to pick up on this even though other class posts help a bit. If it could be put in terms like the "For Dummies" books that would be beneficial.

Thanks
JB

chickentree
04-12-2017, 11:31 PM
Hello all,

Would someone be able to explain parameter and arguments to someone that had no coding background? I have been struggling to pick up on this even though other class posts help a bit. If it could be put in terms like the "For Dummies" books that would be beneficial.

Thanks
JB

When you write a method parameters can be used to pass information to the method. This information can be used and changed within the method without affecting the original values. This allows your method more flexibility.
In the example program I have created a World.lightOn method that takes 4 parameters

Type Name Use
Boolean fromDark If true turn brightness to 0 before starting.
Number time Time to take to change the brightness.
Number maxBrightness How bright to make the light.
Color lightColor What color the light gives off.


So using this new method you can change the light intensity and color by changing the parameters passed in.

Hope this helps
Mark