Rust-like lang.
cargo install forc fuel-core
| // import `thread` module from the standard library | |
| use std::thread; | |
| // entry point of the program | |
| fn main() { | |
| // spawn a new thread with the `spawn` method in the `thread` module | |
| thread::spawn(|| { | |
| println!("hello from the spawned thread"); | |
| } |
| // import `thread` module from std lib and `mpsc` module from `sync` from std lib | |
| use std::thread; | |
| use std::sync::mpsc; | |
| // program entry point | |
| fn main() { | |
| // create sender and receiver with `channel()` | |
| let (sender, receiver) = mpsc::channel(); |
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.17; | |
| // Used in the `name()` function | |
| bytes32 constant nameLength = 0x0000000000000000000000000000000000000000000000000000000000000009; | |
| bytes32 constant nameData = 0x59756c20546f6b656e0000000000000000000000000000000000000000000000; | |
| // Used in the `symbol()` function | |
| bytes32 constant symbolLength = 0x0000000000000000000000000000000000000000000000000000000000000003; | |
| bytes32 constant symbolData = 0x59554c0000000000000000000000000000000000000000000000000000000000; |
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.17; | |
| // Used in the `name()` function | |
| // "Yul Token" | |
| bytes32 constant nameLength = 0x0000000000000000000000000000000000000000000000000000000000000009; | |
| bytes32 constant nameData = 0x59756c20546f6b656e0000000000000000000000000000000000000000000000; | |
| // Used in the `symbol()` function | |
| // "YUL" |
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.18; | |
| // returns 42 | |
| function freePure() pure returns (uint8) { | |
| return 42; | |
| } | |
| // takes a function and returns that same function | |
| function freeHigherOrder( |