Update article

This commit is contained in:
Lee Lup Yuen 2022-08-05 10:10:43 +08:00
parent 8932e2bcde
commit 2c36795d60
8 changed files with 33 additions and 1 deletions

BIN
images/blockly-run7.pdf Normal file

Binary file not shown.

BIN
images/blockly-run7a.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
images/blockly-run7b.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
images/blockly-run8.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
images/blockly-run8.pdf Normal file

Binary file not shown.

BIN
images/blockly-run9.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

BIN
images/blockly-run9.pdf Normal file

Binary file not shown.

View file

@ -300,7 +300,7 @@ __Blockly is Typeless!__
Blockly doesn't recognise Types, so it will gladly accept this...
TODO
![Blocky is Typeless](https://lupyuen.github.io/images/blockly-run8.jpg)
Which works fine with [__Dynamically-Typed Languages__](https://developer.mozilla.org/en-US/docs/Glossary/Dynamic_typing) like JavaScript...
@ -331,8 +331,40 @@ Such apps work only with numeric __Sensor Data__ (like temperature, humidity). A
# Zig Functions
_Can we define Zig Functions in Blockly?_
TODO
![Define Blockly Function](https://lupyuen.github.io/images/blockly-run7a.jpg)
TODO
```zig
fn do_something(x: f32, y: f32) !f32 {
const a: f32 = 123.45;
debug("a={}", .{ a });
return x + y;
}
```
[(To define the parameters, click on __"Settings"__)](https://lupyuen.github.io/images/blockly-run9.jpg)
TODO
![Call Blockly Function](https://lupyuen.github.io/images/blockly-run7b.jpg)
TODO
```zig
const a: f32 = 123.45;
const b: f32 = try do_something(a, a);
debug("b={}", .{ b });
```
TODO
[generators/zig/procedures.js](https://github.com/lupyuen3/blockly-zig-nuttx/blob/master/generators/zig/procedures.js#L18-L92)
# Constants vs Variables
TODO: [BASIC](https://en.wikipedia.org/wiki/BASIC#Syntax)