fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 154: Halfway between two hex color codes
Idiom # 154: Halfway between two hex color codes
See
programming-idioms.org
:
Code
c := for t := "#", t + v.hex 2 i in 1..5 : 2 a1 := (c1.substring i i+2).parse_i32_hex.val a2 := (c2.substring i i+2).parse_i32_hex.val v := (a1 + a2) / 2 else t
What are effects?
Running Example
ex154 is c1 := "#11ffaa" c2 := "#8822ee" c := for t := "#", t + v.hex 2 i in 1..5 : 2 a1 := (c1.substring i i+2).parse_i32_hex.val a2 := (c2.substring i i+2).parse_i32_hex.val v := (a1 + a2) / 2 else t say c
What are effects?
last changed: 2024-07-01
next: Idiom # 155: Delete file