August 2018
Intermediate to advanced
404 pages
11h 19m
English
Yul (previously JULIA) is a new language that can be used for writing inline assembly code. This is an intermediate language that can compile to various backends, such as EVM and eWASM (upcoming). The components of Yul include functions, blocks, variables, literals, for loops, if and switch statements, and assignments.
Here's the power function explained in step 7, rewritten in the Yul language:
function power2(x:u256, y:u256) -> result:u256{ switch y case 0:u256 { result := 1:u256 } case 1:u256 { result := x } default: { result := power(mul(x, x), div(y, 2:u256)) switch mod(y, 2:u256) case 1:u256 { result := mul(x, result) } }}
The supported data types in Yul are bool, u8, s8, u32, s32, u64, s64, u128, s128, u256, and s256 ...
Read now
Unlock full access