#import "modules/std.sx"; #import "modules/math/math.sx"; #import "modules/compiler.sx"; #import "modules/test.sx"; pkg :: #import "modules/testpkg"; Point :: struct { x, y: s32; } main :: () { // ======================================================== // 22. IF-EXPRESSION RETURNING STRUCT // ======================================================== print("=== 22. If-Struct ===\n"); { flag := true; p := if flag { Point.{10, 20}; } else { Point.{30, 40}; }; print("if-struct: {} {}\n", p.x, p.y); q := if !flag { Point.{10, 20}; } else { Point.{30, 40}; }; print("else-struct: {} {}\n", q.x, q.y); } }