if as an expression
Në shqip: if si shprehje
ShpjegimiSQ
Në Rust, if kthen vlerë: let vleresimi = if nota >= 5 { "kalues" } else { "mbetës" };. Kushti duhet të jetë bool — s'ka konvertim automatik nga numrat.
EnglishEN
In Rust, if returns a value: let grade = if mark >= 5 { "pass" } else { "fail" };. The condition must be a bool — no automatic conversion from numbers.
Si ta mendosh
Si një pyetje që të jep menjëherë përgjigjen.
Lexoje në anglisht
Like a question that hands you the answer straight away.
Shembull kodirust
let nota = 7;
let vleresimi = if nota >= 5 { "kalues" } else { "mbetës" };