Alice Community  

Go Back   Alice Community > Alice 3 > How Do I?

Reply
 
Thread Tools Display Modes
Explain parameter and arguments
Old
justmyway2
Junior Member
 
Status: Offline
Posts: 1
Join Date: Apr 2017
Location: Atlanta
Default Explain parameter and arguments - 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
   
Reply With Quote
Parameters
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 210
Join Date: Dec 2012
Location: Frosno, Ca
Default Parameters - 04-12-2017, 11:31 PM

Quote:
Originally Posted by justmyway2 View Post
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
Attached Files
File Type: a2w lightParametersDemo.a2w (247.4 KB, 1 views)


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.