mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Updated tutorial_gdscript_efficiently (markdown)
parent
307d31a9bb
commit
ec93124397
@ -46,5 +46,29 @@ var a # null by default
|
||||
a=5 # valid, 'a' becomes an integer
|
||||
a="Hi!" # valid, 'a' changed to a string
|
||||
```
|
||||
Functions are of dynamic nature too, which means they can be called with different arguments, for example:
|
||||
|
||||
Static:
|
||||
|
||||
```c++
|
||||
void print_value(int value)
|
||||
{
|
||||
printf("value is %i\n,value);
|
||||
}
|
||||
|
||||
[..]
|
||||
|
||||
print_value(55); // valid
|
||||
print_value("Hello"); // invalid
|
||||
```
|
||||
Dynamic:
|
||||
|
||||
```python
|
||||
func print_value(value):
|
||||
|
||||
print(value)
|
||||
[..]
|
||||
|
||||
print_value(55) # valid
|
||||
print_value("Hello") # valid
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user