Argument: Difference between revisions
No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
''Example 1:'' The color argument in PSET is optional | ''Example 1:'' The color argument in PSET is optional | ||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl | {{Cl|SCREEN}} 13 | ||
{{Cl|PSET}} (160, 100) | {{Cl|PSET}} (160, 100) | ||
{{Cl|PSET}} (165, 100), 15 | {{Cl|PSET}} (165, 100), 15 | ||
Line 23: | Line 23: | ||
''Example 2:'' Must place a comma to seperate arguments if you use any other argument after it. | ''Example 2:'' Must place a comma to seperate arguments if you use any other argument after it. | ||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl | {{Cl|SCREEN}} 13 | ||
{{Cl|LINE}} (160, 100)-(170, 110), , B | {{Cl|LINE}} (160, 100)-(170, 110), , B | ||
{{Cl|LINE}} (162, 102)-(168, 108), 4, BF | {{Cl|LINE}} (162, 102)-(168, 108), 4, BF |
Revision as of 10:40, 26 January 2023
An argument or parameter is information that a statement, sub, function or metacommand needs to carry out the task it has been given. Sometimes a argument can be optional and is not needed for the task to be carried out, in such case it will use a default instead of the argument when carrying out the task.
It is currently not possible to make arguments optional in user-defined SUBs or FUNCTIONs, but Galleon (the creator of QB64) is planning that functionality in the future.
Arguments that are optional will be enclosed with [ and ] brackets in syntax descriptions.
More than one argument or parameter are separated by commas.
Examples
Example 1: The color argument in PSET is optional
SCREEN 13 PSET (160, 100) PSET (165, 100), 15 |
Example 2: Must place a comma to seperate arguments if you use any other argument after it.
SCREEN 13 LINE (160, 100)-(170, 110), , B LINE (162, 102)-(168, 108), 4, BF |
As you can see in the above example some statements have special arguments like B and BF in this case (B stands for Box and BF stands for Box Fill), if the argument isn't used then it will create a ordinary line.
See also