[SatCom] Default function parameters (close issue #899)
parent
3b99a62185
commit
0a55020963
|
@ -11,7 +11,7 @@ You probably already know how to create a function. Every program in CBOT must h
|
|||
\s;
|
||||
\s;}
|
||||
\n;
|
||||
Nothing but a name can be changed in the main function. The keyword \c;\l;extern\u cbot\extern;\n; distinguish the main function from others.
|
||||
Nothing but a name can be changed in the main function. The keyword \c;\l;extern\u cbot\extern;\n; distinguishes the main function from others.
|
||||
|
||||
\b;Basic use
|
||||
With functions you can divide your program into several parts. Each of them will execute a specific task. For example, see the following program:
|
||||
|
@ -114,7 +114,7 @@ You can declare several functions with the same name but different parameters:
|
|||
\n;
|
||||
CBOT will call either the one or the other function depending on the parameters passed. They must be distinguishable, i.e. you can't declare two functions with the same name and parameter types in the exact same order, e.g. declaring \c;int Pythagoras(float b, float a)\n; will result in error. Note that result type does not matter.
|
||||
|
||||
\b;Public functions
|
||||
\b;Public Functions
|
||||
You can also declare a function \l;public\u cbot\public; so it can be used by other bots.
|
||||
|
||||
\b;object::
|
||||
|
@ -126,5 +126,41 @@ Declaring a function as a part of the \l;object\u cbot\object; namespace gives i
|
|||
\s;}
|
||||
\n;
|
||||
|
||||
\b;Default Parameters
|
||||
Last function parameters can have default values that can be omitted when calling.
|
||||
\c;
|
||||
\s;float Add(float a = 0.0, float b = 0.0)
|
||||
\s;{
|
||||
\s; return a + b;
|
||||
\s;}
|
||||
\s;
|
||||
\s;// Somewhere in the main program...
|
||||
\s;Add(); // Will return 0.0
|
||||
\s;Add(2.0); // Will return 2.0
|
||||
\s;Add(2.0, 3.0); // Will return 5.0
|
||||
\s;// ...
|
||||
\n;
|
||||
|
||||
\t;Default Parameters and Overloading
|
||||
Functions with default parameters still can be overloaded, one must only ensure that function calls are not ambiguous. For example, consider the following code:
|
||||
\c;
|
||||
\s;float Add(float a = 0.0, float b = 0.0)
|
||||
\s;{
|
||||
\s; return a + b;
|
||||
\s;}
|
||||
\s;
|
||||
\s;string Add(string a = "", string b = "")
|
||||
\s;{
|
||||
\s; return a + b;
|
||||
\s;}
|
||||
\s;
|
||||
\s;// Somewhere in the main program...
|
||||
\s;Add(); // Compilation error: ambiguous call
|
||||
\s;Add(""); // Ok
|
||||
\s;Add(0.0); // Ok
|
||||
\s;// ...
|
||||
\n;
|
||||
Note that in the above example overloading causes the first default parameter to be useless as caller needs to pass it anyway in order to distinguish the two functions.
|
||||
|
||||
\t;See also
|
||||
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
|
||||
|
|
|
@ -53,13 +53,13 @@ msgid "Time in seconds."
|
|||
msgstr ""
|
||||
|
||||
#. type: \t; header
|
||||
#: ../E/abstime.txt:10 ../E/acos.txt:11 ../E/aim.txt:23 ../E/array.txt:41 ../E/asin.txt:11 ../E/atan.txt:11 ../E/atan2.txt:16 ../E/bloc.txt:48 ../E/bool.txt:4 ../E/break.txt:24 ../E/build.txt:27 ../E/buildingenabled.txt:22 ../E/busy.txt:14 ../E/canbuild.txt:22 ../E/canresearch.txt:14 ../E/category.txt:109 ../E/ceil.txt:12 ../E/class.txt:120 ../E/close.txt:6 ../E/cond.txt:4 ../E/continue.txt:24 ../E/cos.txt:11 ../E/deletef.txt:9 ../E/delinfo.txt:13 ../E/destroy.txt:15 ../E/detect.txt:27 ../E/direct.txt:13 ../E/dist.txt:29 ../E/dist2d.txt:13 ../E/do.txt:27 ../E/drop.txt:28 ../E/eof.txt:13 ../E/errmode.txt:32 ../E/expr.txt:197 ../E/extends.txt:105 ../E/extern.txt:29 ../E/factory.txt:21 ../E/false.txt:4 ../E/file.txt:16 ../E/fire.txt:30 ../E/flatgrnd.txt:16 ../E/flatspace.txt:25 ../E/float.txt:24 ../E/floor.txt:12 ../E/for.txt:51 ../E/function.txt:129 ../E/goto.txt:34 ../E/grab.txt:28 ../E/if.txt:39 ../E/int.txt:18 ../E/jet.txt:14 ../E/message.txt:24 ../E/motor.txt:38 ../E/move.txt:21 ../E/nan.txt:14 ../E/new.txt:20 ../E/null.txt:4 ../E/object.txt:79 ../E/open.txt:19 ../E/openfile.txt:11 ../E/pencolor.txt:14 ../E/pendown.txt:17 ../E/penup.txt:11 ../E/penwidth.txt:14 ../E/point.txt:35 ../E/pointer.txt:51 ../E/pow.txt:14 ../E/private.txt:19 ../E/produce.txt:30 ../E/protected.txt:26 ../E/public.txt:49 ../E/radar.txt:80 ../E/radarall.txt:19 ../E/rand.txt:8 ../E/readln.txt:18 ../E/receive.txt:16 ../E/recycle.txt:12 ../E/research.txt:18 ../E/researched.txt:14 ../E/researches.txt:27 ../E/retobj.txt:13 ../E/return.txt:29 ../E/round.txt:12 ../E/search.txt:25 ../E/send.txt:17 ../E/shield.txt:18 ../E/sin.txt:11 ../E/sizeof.txt:21 ../E/sniff.txt:16 ../E/space.txt:22 ../E/sqrt.txt:11 ../E/static.txt:20 ../E/strfind.txt:18 ../E/string.txt:32 ../E/strleft.txt:14 ../E/strlen.txt:12 ../E/strlower.txt:10 ../E/strmid.txt:18 ../E/strright.txt:14 ../E/strupper.txt:10 ../E/strval.txt:17 ../E/super.txt:45 ../E/switch.txt:70 ../E/synchro.txt:23 ../E/takeoff.txt:15 ../E/tan.txt:11 ../E/term.txt:30 ../E/testinfo.txt:16 ../E/this.txt:52 ../E/thump.txt:12 ../E/topo.txt:13 ../E/true.txt:4 ../E/trunc.txt:12 ../E/turn.txt:32 ../E/type.txt:32 ../E/var.txt:66 ../E/void.txt:10 ../E/wait.txt:21 ../E/while.txt:46 ../E/writeln.txt:19
|
||||
#: ../E/abstime.txt:10 ../E/acos.txt:11 ../E/aim.txt:23 ../E/array.txt:41 ../E/asin.txt:11 ../E/atan.txt:11 ../E/atan2.txt:16 ../E/bloc.txt:48 ../E/bool.txt:4 ../E/break.txt:24 ../E/build.txt:27 ../E/buildingenabled.txt:22 ../E/busy.txt:14 ../E/canbuild.txt:22 ../E/canresearch.txt:14 ../E/category.txt:109 ../E/ceil.txt:12 ../E/class.txt:120 ../E/close.txt:6 ../E/cond.txt:4 ../E/continue.txt:24 ../E/cos.txt:11 ../E/deletef.txt:9 ../E/delinfo.txt:13 ../E/destroy.txt:15 ../E/detect.txt:27 ../E/direct.txt:13 ../E/dist.txt:29 ../E/dist2d.txt:13 ../E/do.txt:27 ../E/drop.txt:28 ../E/eof.txt:13 ../E/errmode.txt:32 ../E/expr.txt:197 ../E/extends.txt:105 ../E/extern.txt:29 ../E/factory.txt:21 ../E/false.txt:4 ../E/file.txt:16 ../E/fire.txt:30 ../E/flatgrnd.txt:16 ../E/flatspace.txt:25 ../E/float.txt:24 ../E/floor.txt:12 ../E/for.txt:51 ../E/function.txt:165 ../E/goto.txt:34 ../E/grab.txt:28 ../E/if.txt:39 ../E/int.txt:18 ../E/jet.txt:14 ../E/message.txt:24 ../E/motor.txt:38 ../E/move.txt:21 ../E/nan.txt:14 ../E/new.txt:20 ../E/null.txt:4 ../E/object.txt:79 ../E/open.txt:19 ../E/openfile.txt:11 ../E/pencolor.txt:14 ../E/pendown.txt:17 ../E/penup.txt:11 ../E/penwidth.txt:14 ../E/point.txt:35 ../E/pointer.txt:51 ../E/pow.txt:14 ../E/private.txt:19 ../E/produce.txt:30 ../E/protected.txt:26 ../E/public.txt:49 ../E/radar.txt:80 ../E/radarall.txt:19 ../E/rand.txt:8 ../E/readln.txt:18 ../E/receive.txt:16 ../E/recycle.txt:12 ../E/research.txt:18 ../E/researched.txt:14 ../E/researches.txt:27 ../E/retobj.txt:13 ../E/return.txt:29 ../E/round.txt:12 ../E/search.txt:25 ../E/send.txt:17 ../E/shield.txt:18 ../E/sin.txt:11 ../E/sizeof.txt:21 ../E/sniff.txt:16 ../E/space.txt:22 ../E/sqrt.txt:11 ../E/static.txt:20 ../E/strfind.txt:18 ../E/string.txt:32 ../E/strleft.txt:14 ../E/strlen.txt:12 ../E/strlower.txt:10 ../E/strmid.txt:18 ../E/strright.txt:14 ../E/strupper.txt:10 ../E/strval.txt:17 ../E/super.txt:45 ../E/switch.txt:70 ../E/synchro.txt:23 ../E/takeoff.txt:15 ../E/tan.txt:11 ../E/term.txt:30 ../E/testinfo.txt:16 ../E/this.txt:52 ../E/thump.txt:12 ../E/topo.txt:13 ../E/true.txt:4 ../E/trunc.txt:12 ../E/turn.txt:32 ../E/type.txt:32 ../E/var.txt:66 ../E/void.txt:10 ../E/wait.txt:21 ../E/while.txt:46 ../E/writeln.txt:19
|
||||
#, no-wrap
|
||||
msgid "See also"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/abstime.txt:11 ../E/aim.txt:24 ../E/array.txt:42 ../E/bool.txt:5 ../E/break.txt:25 ../E/busy.txt:15 ../E/cond.txt:5 ../E/continue.txt:25 ../E/deletef.txt:10 ../E/destroy.txt:16 ../E/detect.txt:28 ../E/direct.txt:14 ../E/dist.txt:30 ../E/dist2d.txt:14 ../E/drop.txt:29 ../E/errmode.txt:33 ../E/expr.txt:198 ../E/extern.txt:30 ../E/false.txt:5 ../E/fire.txt:31 ../E/flatgrnd.txt:17 ../E/flatspace.txt:26 ../E/float.txt:25 ../E/for.txt:52 ../E/function.txt:130 ../E/goto.txt:35 ../E/grab.txt:29 ../E/if.txt:40 ../E/int.txt:19 ../E/jet.txt:15 ../E/message.txt:25 ../E/move.txt:22 ../E/nan.txt:15 ../E/object.txt:80 ../E/openfile.txt:12 ../E/pencolor.txt:15 ../E/pendown.txt:18 ../E/penup.txt:12 ../E/penwidth.txt:15 ../E/point.txt:36 ../E/produce.txt:31 ../E/recycle.txt:13 ../E/retobj.txt:14 ../E/return.txt:30 ../E/search.txt:26 ../E/shield.txt:19 ../E/sizeof.txt:22 ../E/sniff.txt:17 ../E/space.txt:23 ../E/string.txt:33 ../E/switch.txt:71 ../E/takeoff.txt:16 ../E/term.txt:31 ../E/thump.txt:13 ../E/topo.txt:14 ../E/true.txt:5 ../E/turn.txt:33 ../E/type.txt:33 ../E/var.txt:67 ../E/void.txt:11 ../E/wait.txt:22
|
||||
#: ../E/abstime.txt:11 ../E/aim.txt:24 ../E/array.txt:42 ../E/bool.txt:5 ../E/break.txt:25 ../E/busy.txt:15 ../E/cond.txt:5 ../E/continue.txt:25 ../E/deletef.txt:10 ../E/destroy.txt:16 ../E/detect.txt:28 ../E/direct.txt:14 ../E/dist.txt:30 ../E/dist2d.txt:14 ../E/drop.txt:29 ../E/errmode.txt:33 ../E/expr.txt:198 ../E/extern.txt:30 ../E/false.txt:5 ../E/fire.txt:31 ../E/flatgrnd.txt:17 ../E/flatspace.txt:26 ../E/float.txt:25 ../E/for.txt:52 ../E/function.txt:166 ../E/goto.txt:35 ../E/grab.txt:29 ../E/if.txt:40 ../E/int.txt:19 ../E/jet.txt:15 ../E/message.txt:25 ../E/move.txt:22 ../E/nan.txt:15 ../E/object.txt:80 ../E/openfile.txt:12 ../E/pencolor.txt:15 ../E/pendown.txt:18 ../E/penup.txt:12 ../E/penwidth.txt:15 ../E/point.txt:36 ../E/produce.txt:31 ../E/recycle.txt:13 ../E/retobj.txt:14 ../E/return.txt:30 ../E/search.txt:26 ../E/shield.txt:19 ../E/sizeof.txt:22 ../E/sniff.txt:17 ../E/space.txt:23 ../E/string.txt:33 ../E/switch.txt:71 ../E/takeoff.txt:16 ../E/term.txt:31 ../E/thump.txt:13 ../E/topo.txt:14 ../E/true.txt:5 ../E/turn.txt:33 ../E/type.txt:33 ../E/var.txt:67 ../E/void.txt:11 ../E/wait.txt:22
|
||||
#, no-wrap
|
||||
msgid "<a cbot>Programming</a>, <a cbot|type>types</a> and <a cbot|category>categories</a>."
|
||||
msgstr ""
|
||||
|
@ -5580,12 +5580,6 @@ msgid ""
|
|||
"}"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:14
|
||||
#, no-wrap
|
||||
msgid "Nothing but a name can be changed in the main function. The keyword <code><a cbot|extern>extern</a></code> distinguish the main function from others."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:17
|
||||
#, no-wrap
|
||||
|
@ -5783,12 +5777,6 @@ msgstr ""
|
|||
msgid "CBOT will call either the one or the other function depending on the parameters passed. They must be distinguishable, i.e. you can't declare two functions with the same name and parameter types in the exact same order, e.g. declaring <code>int Pythagoras(float b, float a)</code> will result in error. Note that result type does not matter."
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:117
|
||||
#, no-wrap
|
||||
msgid "Public functions"
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:120
|
||||
#, no-wrap
|
||||
|
@ -7980,3 +7968,82 @@ msgid ""
|
|||
"<code>\"w\"</code> mode: open for writing.\n"
|
||||
"<code>\"w\"</code> mode: open for appending."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:14
|
||||
#, no-wrap
|
||||
msgid "Nothing but a name can be changed in the main function. The keyword <code><a cbot|extern>extern</a></code> distinguishes the main function from others."
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:117
|
||||
#, no-wrap
|
||||
msgid "Public Functions"
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:129
|
||||
#, no-wrap
|
||||
msgid "Default Parameters"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:130
|
||||
#, no-wrap
|
||||
msgid "Last function parameters can have default values that can be omitted when calling."
|
||||
msgstr ""
|
||||
|
||||
#. type: Source code
|
||||
#: ../E/function.txt:132
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"float Add(float a = 0.0, float b = 0.0)\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Somewhere in the main program...\n"
|
||||
"Add(); // Will return 0.0\n"
|
||||
"Add(2.0); // Will return 2.0\n"
|
||||
"Add(2.0, 3.0); // Will return 5.0\n"
|
||||
"// ..."
|
||||
msgstr ""
|
||||
|
||||
#. type: \t; header
|
||||
#: ../E/function.txt:144
|
||||
#, no-wrap
|
||||
msgid "Default Parameters and Overloading"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:145
|
||||
#, no-wrap
|
||||
msgid "Functions with default parameters still can be overloaded, one must only ensure that function calls are not ambiguous. For example, consider the following code:"
|
||||
msgstr ""
|
||||
|
||||
#. type: Source code
|
||||
#: ../E/function.txt:147
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"float Add(float a = 0.0, float b = 0.0)\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"string Add(string a = \"\", string b = \"\")\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Somewhere in the main program...\n"
|
||||
"Add(); // Compilation error: ambiguous call\n"
|
||||
"Add(\"\"); // Ok\n"
|
||||
"Add(0.0); // Ok\n"
|
||||
"// ..."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:163
|
||||
#, no-wrap
|
||||
msgid "Note that in the above example overloading causes the first default parameter to be useless as caller needs to pass it anyway in order to distinguish the two functions."
|
||||
msgstr ""
|
||||
|
|
|
@ -53,13 +53,13 @@ msgid "Time in seconds."
|
|||
msgstr "Zeit in Sekunden."
|
||||
|
||||
#. type: \t; header
|
||||
#: ../E/abstime.txt:10 ../E/acos.txt:11 ../E/aim.txt:23 ../E/array.txt:41 ../E/asin.txt:11 ../E/atan.txt:11 ../E/atan2.txt:16 ../E/bloc.txt:48 ../E/bool.txt:4 ../E/break.txt:24 ../E/build.txt:27 ../E/buildingenabled.txt:22 ../E/busy.txt:14 ../E/canbuild.txt:22 ../E/canresearch.txt:14 ../E/category.txt:109 ../E/ceil.txt:12 ../E/class.txt:120 ../E/close.txt:6 ../E/cond.txt:4 ../E/continue.txt:24 ../E/cos.txt:11 ../E/deletef.txt:9 ../E/delinfo.txt:13 ../E/destroy.txt:15 ../E/detect.txt:27 ../E/direct.txt:13 ../E/dist.txt:29 ../E/dist2d.txt:13 ../E/do.txt:27 ../E/drop.txt:28 ../E/eof.txt:13 ../E/errmode.txt:32 ../E/expr.txt:197 ../E/extends.txt:105 ../E/extern.txt:29 ../E/factory.txt:21 ../E/false.txt:4 ../E/file.txt:16 ../E/fire.txt:30 ../E/flatgrnd.txt:16 ../E/flatspace.txt:25 ../E/float.txt:24 ../E/floor.txt:12 ../E/for.txt:51 ../E/function.txt:129 ../E/goto.txt:34 ../E/grab.txt:28 ../E/if.txt:39 ../E/int.txt:18 ../E/jet.txt:14 ../E/message.txt:24 ../E/motor.txt:38 ../E/move.txt:21 ../E/nan.txt:14 ../E/new.txt:20 ../E/null.txt:4 ../E/object.txt:79 ../E/open.txt:19 ../E/openfile.txt:11 ../E/pencolor.txt:14 ../E/pendown.txt:17 ../E/penup.txt:11 ../E/penwidth.txt:14 ../E/point.txt:35 ../E/pointer.txt:51 ../E/pow.txt:14 ../E/private.txt:19 ../E/produce.txt:30 ../E/protected.txt:26 ../E/public.txt:49 ../E/radar.txt:80 ../E/radarall.txt:19 ../E/rand.txt:8 ../E/readln.txt:18 ../E/receive.txt:16 ../E/recycle.txt:12 ../E/research.txt:18 ../E/researched.txt:14 ../E/researches.txt:27 ../E/retobj.txt:13 ../E/return.txt:29 ../E/round.txt:12 ../E/search.txt:25 ../E/send.txt:17 ../E/shield.txt:18 ../E/sin.txt:11 ../E/sizeof.txt:21 ../E/sniff.txt:16 ../E/space.txt:22 ../E/sqrt.txt:11 ../E/static.txt:20 ../E/strfind.txt:18 ../E/string.txt:32 ../E/strleft.txt:14 ../E/strlen.txt:12 ../E/strlower.txt:10 ../E/strmid.txt:18 ../E/strright.txt:14 ../E/strupper.txt:10 ../E/strval.txt:17 ../E/super.txt:45 ../E/switch.txt:70 ../E/synchro.txt:23 ../E/takeoff.txt:15 ../E/tan.txt:11 ../E/term.txt:30 ../E/testinfo.txt:16 ../E/this.txt:52 ../E/thump.txt:12 ../E/topo.txt:13 ../E/true.txt:4 ../E/trunc.txt:12 ../E/turn.txt:32 ../E/type.txt:32 ../E/var.txt:66 ../E/void.txt:10 ../E/wait.txt:21 ../E/while.txt:46 ../E/writeln.txt:19
|
||||
#: ../E/abstime.txt:10 ../E/acos.txt:11 ../E/aim.txt:23 ../E/array.txt:41 ../E/asin.txt:11 ../E/atan.txt:11 ../E/atan2.txt:16 ../E/bloc.txt:48 ../E/bool.txt:4 ../E/break.txt:24 ../E/build.txt:27 ../E/buildingenabled.txt:22 ../E/busy.txt:14 ../E/canbuild.txt:22 ../E/canresearch.txt:14 ../E/category.txt:109 ../E/ceil.txt:12 ../E/class.txt:120 ../E/close.txt:6 ../E/cond.txt:4 ../E/continue.txt:24 ../E/cos.txt:11 ../E/deletef.txt:9 ../E/delinfo.txt:13 ../E/destroy.txt:15 ../E/detect.txt:27 ../E/direct.txt:13 ../E/dist.txt:29 ../E/dist2d.txt:13 ../E/do.txt:27 ../E/drop.txt:28 ../E/eof.txt:13 ../E/errmode.txt:32 ../E/expr.txt:197 ../E/extends.txt:105 ../E/extern.txt:29 ../E/factory.txt:21 ../E/false.txt:4 ../E/file.txt:16 ../E/fire.txt:30 ../E/flatgrnd.txt:16 ../E/flatspace.txt:25 ../E/float.txt:24 ../E/floor.txt:12 ../E/for.txt:51 ../E/function.txt:165 ../E/goto.txt:34 ../E/grab.txt:28 ../E/if.txt:39 ../E/int.txt:18 ../E/jet.txt:14 ../E/message.txt:24 ../E/motor.txt:38 ../E/move.txt:21 ../E/nan.txt:14 ../E/new.txt:20 ../E/null.txt:4 ../E/object.txt:79 ../E/open.txt:19 ../E/openfile.txt:11 ../E/pencolor.txt:14 ../E/pendown.txt:17 ../E/penup.txt:11 ../E/penwidth.txt:14 ../E/point.txt:35 ../E/pointer.txt:51 ../E/pow.txt:14 ../E/private.txt:19 ../E/produce.txt:30 ../E/protected.txt:26 ../E/public.txt:49 ../E/radar.txt:80 ../E/radarall.txt:19 ../E/rand.txt:8 ../E/readln.txt:18 ../E/receive.txt:16 ../E/recycle.txt:12 ../E/research.txt:18 ../E/researched.txt:14 ../E/researches.txt:27 ../E/retobj.txt:13 ../E/return.txt:29 ../E/round.txt:12 ../E/search.txt:25 ../E/send.txt:17 ../E/shield.txt:18 ../E/sin.txt:11 ../E/sizeof.txt:21 ../E/sniff.txt:16 ../E/space.txt:22 ../E/sqrt.txt:11 ../E/static.txt:20 ../E/strfind.txt:18 ../E/string.txt:32 ../E/strleft.txt:14 ../E/strlen.txt:12 ../E/strlower.txt:10 ../E/strmid.txt:18 ../E/strright.txt:14 ../E/strupper.txt:10 ../E/strval.txt:17 ../E/super.txt:45 ../E/switch.txt:70 ../E/synchro.txt:23 ../E/takeoff.txt:15 ../E/tan.txt:11 ../E/term.txt:30 ../E/testinfo.txt:16 ../E/this.txt:52 ../E/thump.txt:12 ../E/topo.txt:13 ../E/true.txt:4 ../E/trunc.txt:12 ../E/turn.txt:32 ../E/type.txt:32 ../E/var.txt:66 ../E/void.txt:10 ../E/wait.txt:21 ../E/while.txt:46 ../E/writeln.txt:19
|
||||
#, no-wrap
|
||||
msgid "See also"
|
||||
msgstr "Siehe auch"
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/abstime.txt:11 ../E/aim.txt:24 ../E/array.txt:42 ../E/bool.txt:5 ../E/break.txt:25 ../E/busy.txt:15 ../E/cond.txt:5 ../E/continue.txt:25 ../E/deletef.txt:10 ../E/destroy.txt:16 ../E/detect.txt:28 ../E/direct.txt:14 ../E/dist.txt:30 ../E/dist2d.txt:14 ../E/drop.txt:29 ../E/errmode.txt:33 ../E/expr.txt:198 ../E/extern.txt:30 ../E/false.txt:5 ../E/fire.txt:31 ../E/flatgrnd.txt:17 ../E/flatspace.txt:26 ../E/float.txt:25 ../E/for.txt:52 ../E/function.txt:130 ../E/goto.txt:35 ../E/grab.txt:29 ../E/if.txt:40 ../E/int.txt:19 ../E/jet.txt:15 ../E/message.txt:25 ../E/move.txt:22 ../E/nan.txt:15 ../E/object.txt:80 ../E/openfile.txt:12 ../E/pencolor.txt:15 ../E/pendown.txt:18 ../E/penup.txt:12 ../E/penwidth.txt:15 ../E/point.txt:36 ../E/produce.txt:31 ../E/recycle.txt:13 ../E/retobj.txt:14 ../E/return.txt:30 ../E/search.txt:26 ../E/shield.txt:19 ../E/sizeof.txt:22 ../E/sniff.txt:17 ../E/space.txt:23 ../E/string.txt:33 ../E/switch.txt:71 ../E/takeoff.txt:16 ../E/term.txt:31 ../E/thump.txt:13 ../E/topo.txt:14 ../E/true.txt:5 ../E/turn.txt:33 ../E/type.txt:33 ../E/var.txt:67 ../E/void.txt:11 ../E/wait.txt:22
|
||||
#: ../E/abstime.txt:11 ../E/aim.txt:24 ../E/array.txt:42 ../E/bool.txt:5 ../E/break.txt:25 ../E/busy.txt:15 ../E/cond.txt:5 ../E/continue.txt:25 ../E/deletef.txt:10 ../E/destroy.txt:16 ../E/detect.txt:28 ../E/direct.txt:14 ../E/dist.txt:30 ../E/dist2d.txt:14 ../E/drop.txt:29 ../E/errmode.txt:33 ../E/expr.txt:198 ../E/extern.txt:30 ../E/false.txt:5 ../E/fire.txt:31 ../E/flatgrnd.txt:17 ../E/flatspace.txt:26 ../E/float.txt:25 ../E/for.txt:52 ../E/function.txt:166 ../E/goto.txt:35 ../E/grab.txt:29 ../E/if.txt:40 ../E/int.txt:19 ../E/jet.txt:15 ../E/message.txt:25 ../E/move.txt:22 ../E/nan.txt:15 ../E/object.txt:80 ../E/openfile.txt:12 ../E/pencolor.txt:15 ../E/pendown.txt:18 ../E/penup.txt:12 ../E/penwidth.txt:15 ../E/point.txt:36 ../E/produce.txt:31 ../E/recycle.txt:13 ../E/retobj.txt:14 ../E/return.txt:30 ../E/search.txt:26 ../E/shield.txt:19 ../E/sizeof.txt:22 ../E/sniff.txt:17 ../E/space.txt:23 ../E/string.txt:33 ../E/switch.txt:71 ../E/takeoff.txt:16 ../E/term.txt:31 ../E/thump.txt:13 ../E/topo.txt:14 ../E/true.txt:5 ../E/turn.txt:33 ../E/type.txt:33 ../E/var.txt:67 ../E/void.txt:11 ../E/wait.txt:22
|
||||
#, no-wrap
|
||||
msgid "<a cbot>Programming</a>, <a cbot|type>types</a> and <a cbot|category>categories</a>."
|
||||
msgstr "Die <a cbot>CBOT-Sprache</a>, <a cbot|type>Variablentypen</a> und <a cbot|category>Kategorien</a>."
|
||||
|
@ -6281,12 +6281,6 @@ msgid ""
|
|||
"}"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:14
|
||||
#, no-wrap
|
||||
msgid "Nothing but a name can be changed in the main function. The keyword <code><a cbot|extern>extern</a></code> distinguish the main function from others."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:17
|
||||
#, no-wrap
|
||||
|
@ -6484,12 +6478,6 @@ msgstr ""
|
|||
msgid "CBOT will call either the one or the other function depending on the parameters passed. They must be distinguishable, i.e. you can't declare two functions with the same name and parameter types in the exact same order, e.g. declaring <code>int Pythagoras(float b, float a)</code> will result in error. Note that result type does not matter."
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:117
|
||||
#, no-wrap
|
||||
msgid "Public functions"
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:120
|
||||
#, no-wrap
|
||||
|
@ -8681,3 +8669,82 @@ msgid ""
|
|||
"<code>\"w\"</code> mode: open for writing.\n"
|
||||
"<code>\"w\"</code> mode: open for appending."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:14
|
||||
#, no-wrap
|
||||
msgid "Nothing but a name can be changed in the main function. The keyword <code><a cbot|extern>extern</a></code> distinguishes the main function from others."
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:117
|
||||
#, no-wrap
|
||||
msgid "Public Functions"
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:129
|
||||
#, no-wrap
|
||||
msgid "Default Parameters"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:130
|
||||
#, no-wrap
|
||||
msgid "Last function parameters can have default values that can be omitted when calling."
|
||||
msgstr ""
|
||||
|
||||
#. type: Source code
|
||||
#: ../E/function.txt:132
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"float Add(float a = 0.0, float b = 0.0)\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Somewhere in the main program...\n"
|
||||
"Add(); // Will return 0.0\n"
|
||||
"Add(2.0); // Will return 2.0\n"
|
||||
"Add(2.0, 3.0); // Will return 5.0\n"
|
||||
"// ..."
|
||||
msgstr ""
|
||||
|
||||
#. type: \t; header
|
||||
#: ../E/function.txt:144
|
||||
#, no-wrap
|
||||
msgid "Default Parameters and Overloading"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:145
|
||||
#, no-wrap
|
||||
msgid "Functions with default parameters still can be overloaded, one must only ensure that function calls are not ambiguous. For example, consider the following code:"
|
||||
msgstr ""
|
||||
|
||||
#. type: Source code
|
||||
#: ../E/function.txt:147
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"float Add(float a = 0.0, float b = 0.0)\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"string Add(string a = \"\", string b = \"\")\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Somewhere in the main program...\n"
|
||||
"Add(); // Compilation error: ambiguous call\n"
|
||||
"Add(\"\"); // Ok\n"
|
||||
"Add(0.0); // Ok\n"
|
||||
"// ..."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:163
|
||||
#, no-wrap
|
||||
msgid "Note that in the above example overloading causes the first default parameter to be useless as caller needs to pass it anyway in order to distinguish the two functions."
|
||||
msgstr ""
|
||||
|
|
|
@ -52,13 +52,13 @@ msgid "Time in seconds."
|
|||
msgstr "Temps en secondes."
|
||||
|
||||
#. type: \t; header
|
||||
#: ../E/abstime.txt:10 ../E/acos.txt:11 ../E/aim.txt:23 ../E/array.txt:41 ../E/asin.txt:11 ../E/atan.txt:11 ../E/atan2.txt:16 ../E/bloc.txt:48 ../E/bool.txt:4 ../E/break.txt:24 ../E/build.txt:27 ../E/buildingenabled.txt:22 ../E/busy.txt:14 ../E/canbuild.txt:22 ../E/canresearch.txt:14 ../E/category.txt:109 ../E/ceil.txt:12 ../E/class.txt:120 ../E/close.txt:6 ../E/cond.txt:4 ../E/continue.txt:24 ../E/cos.txt:11 ../E/deletef.txt:9 ../E/delinfo.txt:13 ../E/destroy.txt:15 ../E/detect.txt:27 ../E/direct.txt:13 ../E/dist.txt:29 ../E/dist2d.txt:13 ../E/do.txt:27 ../E/drop.txt:28 ../E/eof.txt:13 ../E/errmode.txt:32 ../E/expr.txt:197 ../E/extends.txt:105 ../E/extern.txt:29 ../E/factory.txt:21 ../E/false.txt:4 ../E/file.txt:16 ../E/fire.txt:30 ../E/flatgrnd.txt:16 ../E/flatspace.txt:25 ../E/float.txt:24 ../E/floor.txt:12 ../E/for.txt:51 ../E/function.txt:129 ../E/goto.txt:34 ../E/grab.txt:28 ../E/if.txt:39 ../E/int.txt:18 ../E/jet.txt:14 ../E/message.txt:24 ../E/motor.txt:38 ../E/move.txt:21 ../E/nan.txt:14 ../E/new.txt:20 ../E/null.txt:4 ../E/object.txt:79 ../E/open.txt:19 ../E/openfile.txt:11 ../E/pencolor.txt:14 ../E/pendown.txt:17 ../E/penup.txt:11 ../E/penwidth.txt:14 ../E/point.txt:35 ../E/pointer.txt:51 ../E/pow.txt:14 ../E/private.txt:19 ../E/produce.txt:30 ../E/protected.txt:26 ../E/public.txt:49 ../E/radar.txt:80 ../E/radarall.txt:19 ../E/rand.txt:8 ../E/readln.txt:18 ../E/receive.txt:16 ../E/recycle.txt:12 ../E/research.txt:18 ../E/researched.txt:14 ../E/researches.txt:27 ../E/retobj.txt:13 ../E/return.txt:29 ../E/round.txt:12 ../E/search.txt:25 ../E/send.txt:17 ../E/shield.txt:18 ../E/sin.txt:11 ../E/sizeof.txt:21 ../E/sniff.txt:16 ../E/space.txt:22 ../E/sqrt.txt:11 ../E/static.txt:20 ../E/strfind.txt:18 ../E/string.txt:32 ../E/strleft.txt:14 ../E/strlen.txt:12 ../E/strlower.txt:10 ../E/strmid.txt:18 ../E/strright.txt:14 ../E/strupper.txt:10 ../E/strval.txt:17 ../E/super.txt:45 ../E/switch.txt:70 ../E/synchro.txt:23 ../E/takeoff.txt:15 ../E/tan.txt:11 ../E/term.txt:30 ../E/testinfo.txt:16 ../E/this.txt:52 ../E/thump.txt:12 ../E/topo.txt:13 ../E/true.txt:4 ../E/trunc.txt:12 ../E/turn.txt:32 ../E/type.txt:32 ../E/var.txt:66 ../E/void.txt:10 ../E/wait.txt:21 ../E/while.txt:46 ../E/writeln.txt:19
|
||||
#: ../E/abstime.txt:10 ../E/acos.txt:11 ../E/aim.txt:23 ../E/array.txt:41 ../E/asin.txt:11 ../E/atan.txt:11 ../E/atan2.txt:16 ../E/bloc.txt:48 ../E/bool.txt:4 ../E/break.txt:24 ../E/build.txt:27 ../E/buildingenabled.txt:22 ../E/busy.txt:14 ../E/canbuild.txt:22 ../E/canresearch.txt:14 ../E/category.txt:109 ../E/ceil.txt:12 ../E/class.txt:120 ../E/close.txt:6 ../E/cond.txt:4 ../E/continue.txt:24 ../E/cos.txt:11 ../E/deletef.txt:9 ../E/delinfo.txt:13 ../E/destroy.txt:15 ../E/detect.txt:27 ../E/direct.txt:13 ../E/dist.txt:29 ../E/dist2d.txt:13 ../E/do.txt:27 ../E/drop.txt:28 ../E/eof.txt:13 ../E/errmode.txt:32 ../E/expr.txt:197 ../E/extends.txt:105 ../E/extern.txt:29 ../E/factory.txt:21 ../E/false.txt:4 ../E/file.txt:16 ../E/fire.txt:30 ../E/flatgrnd.txt:16 ../E/flatspace.txt:25 ../E/float.txt:24 ../E/floor.txt:12 ../E/for.txt:51 ../E/function.txt:165 ../E/goto.txt:34 ../E/grab.txt:28 ../E/if.txt:39 ../E/int.txt:18 ../E/jet.txt:14 ../E/message.txt:24 ../E/motor.txt:38 ../E/move.txt:21 ../E/nan.txt:14 ../E/new.txt:20 ../E/null.txt:4 ../E/object.txt:79 ../E/open.txt:19 ../E/openfile.txt:11 ../E/pencolor.txt:14 ../E/pendown.txt:17 ../E/penup.txt:11 ../E/penwidth.txt:14 ../E/point.txt:35 ../E/pointer.txt:51 ../E/pow.txt:14 ../E/private.txt:19 ../E/produce.txt:30 ../E/protected.txt:26 ../E/public.txt:49 ../E/radar.txt:80 ../E/radarall.txt:19 ../E/rand.txt:8 ../E/readln.txt:18 ../E/receive.txt:16 ../E/recycle.txt:12 ../E/research.txt:18 ../E/researched.txt:14 ../E/researches.txt:27 ../E/retobj.txt:13 ../E/return.txt:29 ../E/round.txt:12 ../E/search.txt:25 ../E/send.txt:17 ../E/shield.txt:18 ../E/sin.txt:11 ../E/sizeof.txt:21 ../E/sniff.txt:16 ../E/space.txt:22 ../E/sqrt.txt:11 ../E/static.txt:20 ../E/strfind.txt:18 ../E/string.txt:32 ../E/strleft.txt:14 ../E/strlen.txt:12 ../E/strlower.txt:10 ../E/strmid.txt:18 ../E/strright.txt:14 ../E/strupper.txt:10 ../E/strval.txt:17 ../E/super.txt:45 ../E/switch.txt:70 ../E/synchro.txt:23 ../E/takeoff.txt:15 ../E/tan.txt:11 ../E/term.txt:30 ../E/testinfo.txt:16 ../E/this.txt:52 ../E/thump.txt:12 ../E/topo.txt:13 ../E/true.txt:4 ../E/trunc.txt:12 ../E/turn.txt:32 ../E/type.txt:32 ../E/var.txt:66 ../E/void.txt:10 ../E/wait.txt:21 ../E/while.txt:46 ../E/writeln.txt:19
|
||||
#, no-wrap
|
||||
msgid "See also"
|
||||
msgstr "Voir aussi"
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/abstime.txt:11 ../E/aim.txt:24 ../E/array.txt:42 ../E/bool.txt:5 ../E/break.txt:25 ../E/busy.txt:15 ../E/cond.txt:5 ../E/continue.txt:25 ../E/deletef.txt:10 ../E/destroy.txt:16 ../E/detect.txt:28 ../E/direct.txt:14 ../E/dist.txt:30 ../E/dist2d.txt:14 ../E/drop.txt:29 ../E/errmode.txt:33 ../E/expr.txt:198 ../E/extern.txt:30 ../E/false.txt:5 ../E/fire.txt:31 ../E/flatgrnd.txt:17 ../E/flatspace.txt:26 ../E/float.txt:25 ../E/for.txt:52 ../E/function.txt:130 ../E/goto.txt:35 ../E/grab.txt:29 ../E/if.txt:40 ../E/int.txt:19 ../E/jet.txt:15 ../E/message.txt:25 ../E/move.txt:22 ../E/nan.txt:15 ../E/object.txt:80 ../E/openfile.txt:12 ../E/pencolor.txt:15 ../E/pendown.txt:18 ../E/penup.txt:12 ../E/penwidth.txt:15 ../E/point.txt:36 ../E/produce.txt:31 ../E/recycle.txt:13 ../E/retobj.txt:14 ../E/return.txt:30 ../E/search.txt:26 ../E/shield.txt:19 ../E/sizeof.txt:22 ../E/sniff.txt:17 ../E/space.txt:23 ../E/string.txt:33 ../E/switch.txt:71 ../E/takeoff.txt:16 ../E/term.txt:31 ../E/thump.txt:13 ../E/topo.txt:14 ../E/true.txt:5 ../E/turn.txt:33 ../E/type.txt:33 ../E/var.txt:67 ../E/void.txt:11 ../E/wait.txt:22
|
||||
#: ../E/abstime.txt:11 ../E/aim.txt:24 ../E/array.txt:42 ../E/bool.txt:5 ../E/break.txt:25 ../E/busy.txt:15 ../E/cond.txt:5 ../E/continue.txt:25 ../E/deletef.txt:10 ../E/destroy.txt:16 ../E/detect.txt:28 ../E/direct.txt:14 ../E/dist.txt:30 ../E/dist2d.txt:14 ../E/drop.txt:29 ../E/errmode.txt:33 ../E/expr.txt:198 ../E/extern.txt:30 ../E/false.txt:5 ../E/fire.txt:31 ../E/flatgrnd.txt:17 ../E/flatspace.txt:26 ../E/float.txt:25 ../E/for.txt:52 ../E/function.txt:166 ../E/goto.txt:35 ../E/grab.txt:29 ../E/if.txt:40 ../E/int.txt:19 ../E/jet.txt:15 ../E/message.txt:25 ../E/move.txt:22 ../E/nan.txt:15 ../E/object.txt:80 ../E/openfile.txt:12 ../E/pencolor.txt:15 ../E/pendown.txt:18 ../E/penup.txt:12 ../E/penwidth.txt:15 ../E/point.txt:36 ../E/produce.txt:31 ../E/recycle.txt:13 ../E/retobj.txt:14 ../E/return.txt:30 ../E/search.txt:26 ../E/shield.txt:19 ../E/sizeof.txt:22 ../E/sniff.txt:17 ../E/space.txt:23 ../E/string.txt:33 ../E/switch.txt:71 ../E/takeoff.txt:16 ../E/term.txt:31 ../E/thump.txt:13 ../E/topo.txt:14 ../E/true.txt:5 ../E/turn.txt:33 ../E/type.txt:33 ../E/var.txt:67 ../E/void.txt:11 ../E/wait.txt:22
|
||||
#, no-wrap
|
||||
msgid "<a cbot>Programming</a>, <a cbot|type>types</a> and <a cbot|category>categories</a>."
|
||||
msgstr "<a cbot>Programmation</a>, <a cbot|type>types</a> et <a cbot|category>catégories</a>."
|
||||
|
@ -6275,12 +6275,6 @@ msgid ""
|
|||
"}"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:14
|
||||
#, no-wrap
|
||||
msgid "Nothing but a name can be changed in the main function. The keyword <code><a cbot|extern>extern</a></code> distinguish the main function from others."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:17
|
||||
#, no-wrap
|
||||
|
@ -6478,12 +6472,6 @@ msgstr ""
|
|||
msgid "CBOT will call either the one or the other function depending on the parameters passed. They must be distinguishable, i.e. you can't declare two functions with the same name and parameter types in the exact same order, e.g. declaring <code>int Pythagoras(float b, float a)</code> will result in error. Note that result type does not matter."
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:117
|
||||
#, no-wrap
|
||||
msgid "Public functions"
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:120
|
||||
#, no-wrap
|
||||
|
@ -8682,3 +8670,82 @@ msgid ""
|
|||
"<code>\"w\"</code> mode: open for writing.\n"
|
||||
"<code>\"w\"</code> mode: open for appending."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:14
|
||||
#, no-wrap
|
||||
msgid "Nothing but a name can be changed in the main function. The keyword <code><a cbot|extern>extern</a></code> distinguishes the main function from others."
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:117
|
||||
#, no-wrap
|
||||
msgid "Public Functions"
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:129
|
||||
#, no-wrap
|
||||
msgid "Default Parameters"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:130
|
||||
#, no-wrap
|
||||
msgid "Last function parameters can have default values that can be omitted when calling."
|
||||
msgstr ""
|
||||
|
||||
#. type: Source code
|
||||
#: ../E/function.txt:132
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"float Add(float a = 0.0, float b = 0.0)\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Somewhere in the main program...\n"
|
||||
"Add(); // Will return 0.0\n"
|
||||
"Add(2.0); // Will return 2.0\n"
|
||||
"Add(2.0, 3.0); // Will return 5.0\n"
|
||||
"// ..."
|
||||
msgstr ""
|
||||
|
||||
#. type: \t; header
|
||||
#: ../E/function.txt:144
|
||||
#, no-wrap
|
||||
msgid "Default Parameters and Overloading"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:145
|
||||
#, no-wrap
|
||||
msgid "Functions with default parameters still can be overloaded, one must only ensure that function calls are not ambiguous. For example, consider the following code:"
|
||||
msgstr ""
|
||||
|
||||
#. type: Source code
|
||||
#: ../E/function.txt:147
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"float Add(float a = 0.0, float b = 0.0)\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"string Add(string a = \"\", string b = \"\")\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Somewhere in the main program...\n"
|
||||
"Add(); // Compilation error: ambiguous call\n"
|
||||
"Add(\"\"); // Ok\n"
|
||||
"Add(0.0); // Ok\n"
|
||||
"// ..."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:163
|
||||
#, no-wrap
|
||||
msgid "Note that in the above example overloading causes the first default parameter to be useless as caller needs to pass it anyway in order to distinguish the two functions."
|
||||
msgstr ""
|
||||
|
|
|
@ -53,13 +53,13 @@ msgid "Time in seconds."
|
|||
msgstr "Czas w sekundach."
|
||||
|
||||
#. type: \t; header
|
||||
#: ../E/abstime.txt:10 ../E/acos.txt:11 ../E/aim.txt:23 ../E/array.txt:41 ../E/asin.txt:11 ../E/atan.txt:11 ../E/atan2.txt:16 ../E/bloc.txt:48 ../E/bool.txt:4 ../E/break.txt:24 ../E/build.txt:27 ../E/buildingenabled.txt:22 ../E/busy.txt:14 ../E/canbuild.txt:22 ../E/canresearch.txt:14 ../E/category.txt:109 ../E/ceil.txt:12 ../E/class.txt:120 ../E/close.txt:6 ../E/cond.txt:4 ../E/continue.txt:24 ../E/cos.txt:11 ../E/deletef.txt:9 ../E/delinfo.txt:13 ../E/destroy.txt:15 ../E/detect.txt:27 ../E/direct.txt:13 ../E/dist.txt:29 ../E/dist2d.txt:13 ../E/do.txt:27 ../E/drop.txt:28 ../E/eof.txt:13 ../E/errmode.txt:32 ../E/expr.txt:197 ../E/extends.txt:105 ../E/extern.txt:29 ../E/factory.txt:21 ../E/false.txt:4 ../E/file.txt:16 ../E/fire.txt:30 ../E/flatgrnd.txt:16 ../E/flatspace.txt:25 ../E/float.txt:24 ../E/floor.txt:12 ../E/for.txt:51 ../E/function.txt:129 ../E/goto.txt:34 ../E/grab.txt:28 ../E/if.txt:39 ../E/int.txt:18 ../E/jet.txt:14 ../E/message.txt:24 ../E/motor.txt:38 ../E/move.txt:21 ../E/nan.txt:14 ../E/new.txt:20 ../E/null.txt:4 ../E/object.txt:79 ../E/open.txt:19 ../E/openfile.txt:11 ../E/pencolor.txt:14 ../E/pendown.txt:17 ../E/penup.txt:11 ../E/penwidth.txt:14 ../E/point.txt:35 ../E/pointer.txt:51 ../E/pow.txt:14 ../E/private.txt:19 ../E/produce.txt:30 ../E/protected.txt:26 ../E/public.txt:49 ../E/radar.txt:80 ../E/radarall.txt:19 ../E/rand.txt:8 ../E/readln.txt:18 ../E/receive.txt:16 ../E/recycle.txt:12 ../E/research.txt:18 ../E/researched.txt:14 ../E/researches.txt:27 ../E/retobj.txt:13 ../E/return.txt:29 ../E/round.txt:12 ../E/search.txt:25 ../E/send.txt:17 ../E/shield.txt:18 ../E/sin.txt:11 ../E/sizeof.txt:21 ../E/sniff.txt:16 ../E/space.txt:22 ../E/sqrt.txt:11 ../E/static.txt:20 ../E/strfind.txt:18 ../E/string.txt:32 ../E/strleft.txt:14 ../E/strlen.txt:12 ../E/strlower.txt:10 ../E/strmid.txt:18 ../E/strright.txt:14 ../E/strupper.txt:10 ../E/strval.txt:17 ../E/super.txt:45 ../E/switch.txt:70 ../E/synchro.txt:23 ../E/takeoff.txt:15 ../E/tan.txt:11 ../E/term.txt:30 ../E/testinfo.txt:16 ../E/this.txt:52 ../E/thump.txt:12 ../E/topo.txt:13 ../E/true.txt:4 ../E/trunc.txt:12 ../E/turn.txt:32 ../E/type.txt:32 ../E/var.txt:66 ../E/void.txt:10 ../E/wait.txt:21 ../E/while.txt:46 ../E/writeln.txt:19
|
||||
#: ../E/abstime.txt:10 ../E/acos.txt:11 ../E/aim.txt:23 ../E/array.txt:41 ../E/asin.txt:11 ../E/atan.txt:11 ../E/atan2.txt:16 ../E/bloc.txt:48 ../E/bool.txt:4 ../E/break.txt:24 ../E/build.txt:27 ../E/buildingenabled.txt:22 ../E/busy.txt:14 ../E/canbuild.txt:22 ../E/canresearch.txt:14 ../E/category.txt:109 ../E/ceil.txt:12 ../E/class.txt:120 ../E/close.txt:6 ../E/cond.txt:4 ../E/continue.txt:24 ../E/cos.txt:11 ../E/deletef.txt:9 ../E/delinfo.txt:13 ../E/destroy.txt:15 ../E/detect.txt:27 ../E/direct.txt:13 ../E/dist.txt:29 ../E/dist2d.txt:13 ../E/do.txt:27 ../E/drop.txt:28 ../E/eof.txt:13 ../E/errmode.txt:32 ../E/expr.txt:197 ../E/extends.txt:105 ../E/extern.txt:29 ../E/factory.txt:21 ../E/false.txt:4 ../E/file.txt:16 ../E/fire.txt:30 ../E/flatgrnd.txt:16 ../E/flatspace.txt:25 ../E/float.txt:24 ../E/floor.txt:12 ../E/for.txt:51 ../E/function.txt:165 ../E/goto.txt:34 ../E/grab.txt:28 ../E/if.txt:39 ../E/int.txt:18 ../E/jet.txt:14 ../E/message.txt:24 ../E/motor.txt:38 ../E/move.txt:21 ../E/nan.txt:14 ../E/new.txt:20 ../E/null.txt:4 ../E/object.txt:79 ../E/open.txt:19 ../E/openfile.txt:11 ../E/pencolor.txt:14 ../E/pendown.txt:17 ../E/penup.txt:11 ../E/penwidth.txt:14 ../E/point.txt:35 ../E/pointer.txt:51 ../E/pow.txt:14 ../E/private.txt:19 ../E/produce.txt:30 ../E/protected.txt:26 ../E/public.txt:49 ../E/radar.txt:80 ../E/radarall.txt:19 ../E/rand.txt:8 ../E/readln.txt:18 ../E/receive.txt:16 ../E/recycle.txt:12 ../E/research.txt:18 ../E/researched.txt:14 ../E/researches.txt:27 ../E/retobj.txt:13 ../E/return.txt:29 ../E/round.txt:12 ../E/search.txt:25 ../E/send.txt:17 ../E/shield.txt:18 ../E/sin.txt:11 ../E/sizeof.txt:21 ../E/sniff.txt:16 ../E/space.txt:22 ../E/sqrt.txt:11 ../E/static.txt:20 ../E/strfind.txt:18 ../E/string.txt:32 ../E/strleft.txt:14 ../E/strlen.txt:12 ../E/strlower.txt:10 ../E/strmid.txt:18 ../E/strright.txt:14 ../E/strupper.txt:10 ../E/strval.txt:17 ../E/super.txt:45 ../E/switch.txt:70 ../E/synchro.txt:23 ../E/takeoff.txt:15 ../E/tan.txt:11 ../E/term.txt:30 ../E/testinfo.txt:16 ../E/this.txt:52 ../E/thump.txt:12 ../E/topo.txt:13 ../E/true.txt:4 ../E/trunc.txt:12 ../E/turn.txt:32 ../E/type.txt:32 ../E/var.txt:66 ../E/void.txt:10 ../E/wait.txt:21 ../E/while.txt:46 ../E/writeln.txt:19
|
||||
#, no-wrap
|
||||
msgid "See also"
|
||||
msgstr "Zobacz również"
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/abstime.txt:11 ../E/aim.txt:24 ../E/array.txt:42 ../E/bool.txt:5 ../E/break.txt:25 ../E/busy.txt:15 ../E/cond.txt:5 ../E/continue.txt:25 ../E/deletef.txt:10 ../E/destroy.txt:16 ../E/detect.txt:28 ../E/direct.txt:14 ../E/dist.txt:30 ../E/dist2d.txt:14 ../E/drop.txt:29 ../E/errmode.txt:33 ../E/expr.txt:198 ../E/extern.txt:30 ../E/false.txt:5 ../E/fire.txt:31 ../E/flatgrnd.txt:17 ../E/flatspace.txt:26 ../E/float.txt:25 ../E/for.txt:52 ../E/function.txt:130 ../E/goto.txt:35 ../E/grab.txt:29 ../E/if.txt:40 ../E/int.txt:19 ../E/jet.txt:15 ../E/message.txt:25 ../E/move.txt:22 ../E/nan.txt:15 ../E/object.txt:80 ../E/openfile.txt:12 ../E/pencolor.txt:15 ../E/pendown.txt:18 ../E/penup.txt:12 ../E/penwidth.txt:15 ../E/point.txt:36 ../E/produce.txt:31 ../E/recycle.txt:13 ../E/retobj.txt:14 ../E/return.txt:30 ../E/search.txt:26 ../E/shield.txt:19 ../E/sizeof.txt:22 ../E/sniff.txt:17 ../E/space.txt:23 ../E/string.txt:33 ../E/switch.txt:71 ../E/takeoff.txt:16 ../E/term.txt:31 ../E/thump.txt:13 ../E/topo.txt:14 ../E/true.txt:5 ../E/turn.txt:33 ../E/type.txt:33 ../E/var.txt:67 ../E/void.txt:11 ../E/wait.txt:22
|
||||
#: ../E/abstime.txt:11 ../E/aim.txt:24 ../E/array.txt:42 ../E/bool.txt:5 ../E/break.txt:25 ../E/busy.txt:15 ../E/cond.txt:5 ../E/continue.txt:25 ../E/deletef.txt:10 ../E/destroy.txt:16 ../E/detect.txt:28 ../E/direct.txt:14 ../E/dist.txt:30 ../E/dist2d.txt:14 ../E/drop.txt:29 ../E/errmode.txt:33 ../E/expr.txt:198 ../E/extern.txt:30 ../E/false.txt:5 ../E/fire.txt:31 ../E/flatgrnd.txt:17 ../E/flatspace.txt:26 ../E/float.txt:25 ../E/for.txt:52 ../E/function.txt:166 ../E/goto.txt:35 ../E/grab.txt:29 ../E/if.txt:40 ../E/int.txt:19 ../E/jet.txt:15 ../E/message.txt:25 ../E/move.txt:22 ../E/nan.txt:15 ../E/object.txt:80 ../E/openfile.txt:12 ../E/pencolor.txt:15 ../E/pendown.txt:18 ../E/penup.txt:12 ../E/penwidth.txt:15 ../E/point.txt:36 ../E/produce.txt:31 ../E/recycle.txt:13 ../E/retobj.txt:14 ../E/return.txt:30 ../E/search.txt:26 ../E/shield.txt:19 ../E/sizeof.txt:22 ../E/sniff.txt:17 ../E/space.txt:23 ../E/string.txt:33 ../E/switch.txt:71 ../E/takeoff.txt:16 ../E/term.txt:31 ../E/thump.txt:13 ../E/topo.txt:14 ../E/true.txt:5 ../E/turn.txt:33 ../E/type.txt:33 ../E/var.txt:67 ../E/void.txt:11 ../E/wait.txt:22
|
||||
#, no-wrap
|
||||
msgid "<a cbot>Programming</a>, <a cbot|type>types</a> and <a cbot|category>categories</a>."
|
||||
msgstr "<a cbot>Programowanie</a>, <a cbot|type>typy</a> i <a cbot|category>kategorie</a>."
|
||||
|
@ -6338,12 +6338,6 @@ msgstr ""
|
|||
"\t\n"
|
||||
"}"
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:14
|
||||
#, no-wrap
|
||||
msgid "Nothing but a name can be changed in the main function. The keyword <code><a cbot|extern>extern</a></code> distinguish the main function from others."
|
||||
msgstr "W funkcji głównej możesz zmienić tylko nazwę. Słowo <code><a cbot|extern>extern</a></code> odróżnia funkcję główną od pozostałych."
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:17
|
||||
#, no-wrap
|
||||
|
@ -6606,12 +6600,6 @@ msgstr ""
|
|||
msgid "CBOT will call either the one or the other function depending on the parameters passed. They must be distinguishable, i.e. you can't declare two functions with the same name and parameter types in the exact same order, e.g. declaring <code>int Pythagoras(float b, float a)</code> will result in error. Note that result type does not matter."
|
||||
msgstr "CBOT wywoła jedną z funkcji w zależności od przekazanych parametrów. Funkcje muszą być odróżnialne, tzn. nie możesz zadeklarować dwóch funkcji o takiej samej nazwie i typach parametrów w tej samej kolejności. Odnosząc się do przykładu: zadeklarowanie funkcji <code>int Pythagoras(float b, float a)</code> wywoła błąd. Zwróć uwagę, że typ wyniku, jaki zwraca funkcja, nie ma znaczenia."
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:117
|
||||
#, no-wrap
|
||||
msgid "Public functions"
|
||||
msgstr "Funkcje publiczne"
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:120
|
||||
#, no-wrap
|
||||
|
@ -8847,3 +8835,82 @@ msgid ""
|
|||
"<code>\"w\"</code> mode: open for writing.\n"
|
||||
"<code>\"w\"</code> mode: open for appending."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:14
|
||||
#, no-wrap
|
||||
msgid "Nothing but a name can be changed in the main function. The keyword <code><a cbot|extern>extern</a></code> distinguishes the main function from others."
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:117
|
||||
#, no-wrap
|
||||
msgid "Public Functions"
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:129
|
||||
#, no-wrap
|
||||
msgid "Default Parameters"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:130
|
||||
#, no-wrap
|
||||
msgid "Last function parameters can have default values that can be omitted when calling."
|
||||
msgstr ""
|
||||
|
||||
#. type: Source code
|
||||
#: ../E/function.txt:132
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"float Add(float a = 0.0, float b = 0.0)\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Somewhere in the main program...\n"
|
||||
"Add(); // Will return 0.0\n"
|
||||
"Add(2.0); // Will return 2.0\n"
|
||||
"Add(2.0, 3.0); // Will return 5.0\n"
|
||||
"// ..."
|
||||
msgstr ""
|
||||
|
||||
#. type: \t; header
|
||||
#: ../E/function.txt:144
|
||||
#, no-wrap
|
||||
msgid "Default Parameters and Overloading"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:145
|
||||
#, no-wrap
|
||||
msgid "Functions with default parameters still can be overloaded, one must only ensure that function calls are not ambiguous. For example, consider the following code:"
|
||||
msgstr ""
|
||||
|
||||
#. type: Source code
|
||||
#: ../E/function.txt:147
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"float Add(float a = 0.0, float b = 0.0)\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"string Add(string a = \"\", string b = \"\")\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Somewhere in the main program...\n"
|
||||
"Add(); // Compilation error: ambiguous call\n"
|
||||
"Add(\"\"); // Ok\n"
|
||||
"Add(0.0); // Ok\n"
|
||||
"// ..."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:163
|
||||
#, no-wrap
|
||||
msgid "Note that in the above example overloading causes the first default parameter to be useless as caller needs to pass it anyway in order to distinguish the two functions."
|
||||
msgstr ""
|
||||
|
|
|
@ -53,13 +53,13 @@ msgid "Time in seconds."
|
|||
msgstr ""
|
||||
|
||||
#. type: \t; header
|
||||
#: ../E/abstime.txt:10 ../E/acos.txt:11 ../E/aim.txt:23 ../E/array.txt:41 ../E/asin.txt:11 ../E/atan.txt:11 ../E/atan2.txt:16 ../E/bloc.txt:48 ../E/bool.txt:4 ../E/break.txt:24 ../E/build.txt:27 ../E/buildingenabled.txt:22 ../E/busy.txt:14 ../E/canbuild.txt:22 ../E/canresearch.txt:14 ../E/category.txt:109 ../E/ceil.txt:12 ../E/class.txt:120 ../E/close.txt:6 ../E/cond.txt:4 ../E/continue.txt:24 ../E/cos.txt:11 ../E/deletef.txt:9 ../E/delinfo.txt:13 ../E/destroy.txt:15 ../E/detect.txt:27 ../E/direct.txt:13 ../E/dist.txt:29 ../E/dist2d.txt:13 ../E/do.txt:27 ../E/drop.txt:28 ../E/eof.txt:13 ../E/errmode.txt:32 ../E/expr.txt:197 ../E/extends.txt:105 ../E/extern.txt:29 ../E/factory.txt:21 ../E/false.txt:4 ../E/file.txt:16 ../E/fire.txt:30 ../E/flatgrnd.txt:16 ../E/flatspace.txt:25 ../E/float.txt:24 ../E/floor.txt:12 ../E/for.txt:51 ../E/function.txt:129 ../E/goto.txt:34 ../E/grab.txt:28 ../E/if.txt:39 ../E/int.txt:18 ../E/jet.txt:14 ../E/message.txt:24 ../E/motor.txt:38 ../E/move.txt:21 ../E/nan.txt:14 ../E/new.txt:20 ../E/null.txt:4 ../E/object.txt:79 ../E/open.txt:19 ../E/openfile.txt:11 ../E/pencolor.txt:14 ../E/pendown.txt:17 ../E/penup.txt:11 ../E/penwidth.txt:14 ../E/point.txt:35 ../E/pointer.txt:51 ../E/pow.txt:14 ../E/private.txt:19 ../E/produce.txt:30 ../E/protected.txt:26 ../E/public.txt:49 ../E/radar.txt:80 ../E/radarall.txt:19 ../E/rand.txt:8 ../E/readln.txt:18 ../E/receive.txt:16 ../E/recycle.txt:12 ../E/research.txt:18 ../E/researched.txt:14 ../E/researches.txt:27 ../E/retobj.txt:13 ../E/return.txt:29 ../E/round.txt:12 ../E/search.txt:25 ../E/send.txt:17 ../E/shield.txt:18 ../E/sin.txt:11 ../E/sizeof.txt:21 ../E/sniff.txt:16 ../E/space.txt:22 ../E/sqrt.txt:11 ../E/static.txt:20 ../E/strfind.txt:18 ../E/string.txt:32 ../E/strleft.txt:14 ../E/strlen.txt:12 ../E/strlower.txt:10 ../E/strmid.txt:18 ../E/strright.txt:14 ../E/strupper.txt:10 ../E/strval.txt:17 ../E/super.txt:45 ../E/switch.txt:70 ../E/synchro.txt:23 ../E/takeoff.txt:15 ../E/tan.txt:11 ../E/term.txt:30 ../E/testinfo.txt:16 ../E/this.txt:52 ../E/thump.txt:12 ../E/topo.txt:13 ../E/true.txt:4 ../E/trunc.txt:12 ../E/turn.txt:32 ../E/type.txt:32 ../E/var.txt:66 ../E/void.txt:10 ../E/wait.txt:21 ../E/while.txt:46 ../E/writeln.txt:19
|
||||
#: ../E/abstime.txt:10 ../E/acos.txt:11 ../E/aim.txt:23 ../E/array.txt:41 ../E/asin.txt:11 ../E/atan.txt:11 ../E/atan2.txt:16 ../E/bloc.txt:48 ../E/bool.txt:4 ../E/break.txt:24 ../E/build.txt:27 ../E/buildingenabled.txt:22 ../E/busy.txt:14 ../E/canbuild.txt:22 ../E/canresearch.txt:14 ../E/category.txt:109 ../E/ceil.txt:12 ../E/class.txt:120 ../E/close.txt:6 ../E/cond.txt:4 ../E/continue.txt:24 ../E/cos.txt:11 ../E/deletef.txt:9 ../E/delinfo.txt:13 ../E/destroy.txt:15 ../E/detect.txt:27 ../E/direct.txt:13 ../E/dist.txt:29 ../E/dist2d.txt:13 ../E/do.txt:27 ../E/drop.txt:28 ../E/eof.txt:13 ../E/errmode.txt:32 ../E/expr.txt:197 ../E/extends.txt:105 ../E/extern.txt:29 ../E/factory.txt:21 ../E/false.txt:4 ../E/file.txt:16 ../E/fire.txt:30 ../E/flatgrnd.txt:16 ../E/flatspace.txt:25 ../E/float.txt:24 ../E/floor.txt:12 ../E/for.txt:51 ../E/function.txt:165 ../E/goto.txt:34 ../E/grab.txt:28 ../E/if.txt:39 ../E/int.txt:18 ../E/jet.txt:14 ../E/message.txt:24 ../E/motor.txt:38 ../E/move.txt:21 ../E/nan.txt:14 ../E/new.txt:20 ../E/null.txt:4 ../E/object.txt:79 ../E/open.txt:19 ../E/openfile.txt:11 ../E/pencolor.txt:14 ../E/pendown.txt:17 ../E/penup.txt:11 ../E/penwidth.txt:14 ../E/point.txt:35 ../E/pointer.txt:51 ../E/pow.txt:14 ../E/private.txt:19 ../E/produce.txt:30 ../E/protected.txt:26 ../E/public.txt:49 ../E/radar.txt:80 ../E/radarall.txt:19 ../E/rand.txt:8 ../E/readln.txt:18 ../E/receive.txt:16 ../E/recycle.txt:12 ../E/research.txt:18 ../E/researched.txt:14 ../E/researches.txt:27 ../E/retobj.txt:13 ../E/return.txt:29 ../E/round.txt:12 ../E/search.txt:25 ../E/send.txt:17 ../E/shield.txt:18 ../E/sin.txt:11 ../E/sizeof.txt:21 ../E/sniff.txt:16 ../E/space.txt:22 ../E/sqrt.txt:11 ../E/static.txt:20 ../E/strfind.txt:18 ../E/string.txt:32 ../E/strleft.txt:14 ../E/strlen.txt:12 ../E/strlower.txt:10 ../E/strmid.txt:18 ../E/strright.txt:14 ../E/strupper.txt:10 ../E/strval.txt:17 ../E/super.txt:45 ../E/switch.txt:70 ../E/synchro.txt:23 ../E/takeoff.txt:15 ../E/tan.txt:11 ../E/term.txt:30 ../E/testinfo.txt:16 ../E/this.txt:52 ../E/thump.txt:12 ../E/topo.txt:13 ../E/true.txt:4 ../E/trunc.txt:12 ../E/turn.txt:32 ../E/type.txt:32 ../E/var.txt:66 ../E/void.txt:10 ../E/wait.txt:21 ../E/while.txt:46 ../E/writeln.txt:19
|
||||
#, no-wrap
|
||||
msgid "See also"
|
||||
msgstr "См. также"
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/abstime.txt:11 ../E/aim.txt:24 ../E/array.txt:42 ../E/bool.txt:5 ../E/break.txt:25 ../E/busy.txt:15 ../E/cond.txt:5 ../E/continue.txt:25 ../E/deletef.txt:10 ../E/destroy.txt:16 ../E/detect.txt:28 ../E/direct.txt:14 ../E/dist.txt:30 ../E/dist2d.txt:14 ../E/drop.txt:29 ../E/errmode.txt:33 ../E/expr.txt:198 ../E/extern.txt:30 ../E/false.txt:5 ../E/fire.txt:31 ../E/flatgrnd.txt:17 ../E/flatspace.txt:26 ../E/float.txt:25 ../E/for.txt:52 ../E/function.txt:130 ../E/goto.txt:35 ../E/grab.txt:29 ../E/if.txt:40 ../E/int.txt:19 ../E/jet.txt:15 ../E/message.txt:25 ../E/move.txt:22 ../E/nan.txt:15 ../E/object.txt:80 ../E/openfile.txt:12 ../E/pencolor.txt:15 ../E/pendown.txt:18 ../E/penup.txt:12 ../E/penwidth.txt:15 ../E/point.txt:36 ../E/produce.txt:31 ../E/recycle.txt:13 ../E/retobj.txt:14 ../E/return.txt:30 ../E/search.txt:26 ../E/shield.txt:19 ../E/sizeof.txt:22 ../E/sniff.txt:17 ../E/space.txt:23 ../E/string.txt:33 ../E/switch.txt:71 ../E/takeoff.txt:16 ../E/term.txt:31 ../E/thump.txt:13 ../E/topo.txt:14 ../E/true.txt:5 ../E/turn.txt:33 ../E/type.txt:33 ../E/var.txt:67 ../E/void.txt:11 ../E/wait.txt:22
|
||||
#: ../E/abstime.txt:11 ../E/aim.txt:24 ../E/array.txt:42 ../E/bool.txt:5 ../E/break.txt:25 ../E/busy.txt:15 ../E/cond.txt:5 ../E/continue.txt:25 ../E/deletef.txt:10 ../E/destroy.txt:16 ../E/detect.txt:28 ../E/direct.txt:14 ../E/dist.txt:30 ../E/dist2d.txt:14 ../E/drop.txt:29 ../E/errmode.txt:33 ../E/expr.txt:198 ../E/extern.txt:30 ../E/false.txt:5 ../E/fire.txt:31 ../E/flatgrnd.txt:17 ../E/flatspace.txt:26 ../E/float.txt:25 ../E/for.txt:52 ../E/function.txt:166 ../E/goto.txt:35 ../E/grab.txt:29 ../E/if.txt:40 ../E/int.txt:19 ../E/jet.txt:15 ../E/message.txt:25 ../E/move.txt:22 ../E/nan.txt:15 ../E/object.txt:80 ../E/openfile.txt:12 ../E/pencolor.txt:15 ../E/pendown.txt:18 ../E/penup.txt:12 ../E/penwidth.txt:15 ../E/point.txt:36 ../E/produce.txt:31 ../E/recycle.txt:13 ../E/retobj.txt:14 ../E/return.txt:30 ../E/search.txt:26 ../E/shield.txt:19 ../E/sizeof.txt:22 ../E/sniff.txt:17 ../E/space.txt:23 ../E/string.txt:33 ../E/switch.txt:71 ../E/takeoff.txt:16 ../E/term.txt:31 ../E/thump.txt:13 ../E/topo.txt:14 ../E/true.txt:5 ../E/turn.txt:33 ../E/type.txt:33 ../E/var.txt:67 ../E/void.txt:11 ../E/wait.txt:22
|
||||
#, no-wrap
|
||||
msgid "<a cbot>Programming</a>, <a cbot|type>types</a> and <a cbot|category>categories</a>."
|
||||
msgstr "<a cbot>Программирование</a>, <a cbot|type>типы</a> и <a cbot|category>категории</a>."
|
||||
|
@ -6260,12 +6260,6 @@ msgid ""
|
|||
"}"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:14
|
||||
#, no-wrap
|
||||
msgid "Nothing but a name can be changed in the main function. The keyword <code><a cbot|extern>extern</a></code> distinguish the main function from others."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:17
|
||||
#, no-wrap
|
||||
|
@ -6463,12 +6457,6 @@ msgstr ""
|
|||
msgid "CBOT will call either the one or the other function depending on the parameters passed. They must be distinguishable, i.e. you can't declare two functions with the same name and parameter types in the exact same order, e.g. declaring <code>int Pythagoras(float b, float a)</code> will result in error. Note that result type does not matter."
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:117
|
||||
#, no-wrap
|
||||
msgid "Public functions"
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:120
|
||||
#, no-wrap
|
||||
|
@ -8660,3 +8648,82 @@ msgid ""
|
|||
"<code>\"w\"</code> mode: open for writing.\n"
|
||||
"<code>\"w\"</code> mode: open for appending."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:14
|
||||
#, no-wrap
|
||||
msgid "Nothing but a name can be changed in the main function. The keyword <code><a cbot|extern>extern</a></code> distinguishes the main function from others."
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:117
|
||||
#, no-wrap
|
||||
msgid "Public Functions"
|
||||
msgstr ""
|
||||
|
||||
#. type: \b; header
|
||||
#: ../E/function.txt:129
|
||||
#, no-wrap
|
||||
msgid "Default Parameters"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:130
|
||||
#, no-wrap
|
||||
msgid "Last function parameters can have default values that can be omitted when calling."
|
||||
msgstr ""
|
||||
|
||||
#. type: Source code
|
||||
#: ../E/function.txt:132
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"float Add(float a = 0.0, float b = 0.0)\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Somewhere in the main program...\n"
|
||||
"Add(); // Will return 0.0\n"
|
||||
"Add(2.0); // Will return 2.0\n"
|
||||
"Add(2.0, 3.0); // Will return 5.0\n"
|
||||
"// ..."
|
||||
msgstr ""
|
||||
|
||||
#. type: \t; header
|
||||
#: ../E/function.txt:144
|
||||
#, no-wrap
|
||||
msgid "Default Parameters and Overloading"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:145
|
||||
#, no-wrap
|
||||
msgid "Functions with default parameters still can be overloaded, one must only ensure that function calls are not ambiguous. For example, consider the following code:"
|
||||
msgstr ""
|
||||
|
||||
#. type: Source code
|
||||
#: ../E/function.txt:147
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"float Add(float a = 0.0, float b = 0.0)\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"string Add(string a = \"\", string b = \"\")\n"
|
||||
"{\n"
|
||||
"\treturn a + b;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Somewhere in the main program...\n"
|
||||
"Add(); // Compilation error: ambiguous call\n"
|
||||
"Add(\"\"); // Ok\n"
|
||||
"Add(0.0); // Ok\n"
|
||||
"// ..."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: ../E/function.txt:163
|
||||
#, no-wrap
|
||||
msgid "Note that in the above example overloading causes the first default parameter to be useless as caller needs to pass it anyway in order to distinguish the two functions."
|
||||
msgstr ""
|
||||
|
|
Loading…
Reference in New Issue