さび/Booleanos enさびにおけるブール類
rust playgroundで主なコードを確認できます.
#![allow(unused)]
fn main() {
let false_bool = false;
let true_bool = true;
let int_false_bool: i32 = false_bool as i32;
let int_true_bool: i32 = true_bool as i32;
println!("{false_bool}");//false
println!("{true_bool}");//true
println!("{int_false_bool}");//0
println!("{int_true_bool}");//1
let have_you_mined_cripto = true;
if have_you_mined_cripto {
println!("Yes");//true
} else {
println!("No");//false
}
match have_you_mined_cripto {
true => println!("But is not profitable"),
false => println!("I heard that crypto thing is all a scam"),
}
}
boolは値を表します.ユーティリティにはいくつかありますが、特に構造体では私たちに役立つでしょう.boolが整数に変換されるならば、trueは1で、falseが0です#![allow(unused)]
fn main() {
let false_bool = false;
let true_bool = true;
let int_false_bool: i32 = false_bool as i32;
let int_true_bool: i32 = true_bool as i32;
println!("{false_bool}");//false
println!("{true_bool}");//true
println!("{int_false_bool}");//0
println!("{int_true_bool}");//1
}
Boorenesはif
ステートメントで使用されます.最初のブラケットが真の文で、残りはすべて偽です.let have_you_mined_cripto = true;
if have_you_mined_cripto {
println!("Yes");//true
} else {
println!("No");//false
}
match
で手動で割り当てることもできます.match have_you_mined_cripto {
true => println!("But is not profitable"),
false => println!("I heard that crypto thing is all a scam"),
教皇共済主義者エル・C・ディゴー校長en rust playground :
#![allow(unused)]
fn main() {
let false_bool = false;
let true_bool = true;
let int_false_bool: i32 = false_bool as i32;
let int_true_bool: i32 = true_bool as i32;
println!("{false_bool}");//false
println!("{true_bool}");//true
println!("{int_false_bool}");//0
println!("{int_true_bool}");//1
let have_you_mined_cripto = true;
if have_you_mined_cripto {
println!("Yes");//true
} else {
println!("No");//false
}
match have_you_mined_cripto {
true => println!("But is not profitable"),
false => println!("I heard that crypto thing is all a scam"),
}
}
エルBool Representa Unvalor、queソロpuede ser verdadero o fso.Tiene Varias , Pero Nos Servirによる利用Si - Se convierte un Bool en un Entero , Verdadero ser - 1 y Fly ser - 0 :#![allow(unused)]
fn main() {
let false_bool = false;
let true_bool = true;
let int_false_bool: i32 = false_bool as i32;
let int_true_bool: i32 = true_bool as i32;
println!("{false_bool}");//false
println!("{true_bool}");//true
println!("{int_false_bool}");//0
println!("{int_true_bool}");//1
}
ロスBoolenos息子利用者エヌセンチメント.<研究ノート>シートナー・プライマー・コーチェーテの場合let have_you_mined_cripto = true;
if have_you_mined_cripto {
println!("Yes");//true
} else {
println!("No");//false
}
<資料>タビビの詩的民俗学match have_you_mined_cripto {
true => println!("But is not profitable"),
false => println!("I heard that crypto thing is all a scam"),
<研究ノート>非公務員Cualquiera , N . Bootcamp de Programaci de n . Puedes Ver resultado el rust playgroundについてstruct Student {
name: String,
email: String,
dni: u64,
year: u8,
male: bool,
blockchain_knowledge: bool,
}
fn main(){
let mateo_lafalce = Student {
name: String::from("Mateo Lafalce"),
email: String::from("[email protected]"),
dni: 45996810,
year: 6,
male: true,
blockchain_knowledge: true,
};
println!("\n{}\n{}\n{}\n{}\n{}\n{}\n", mateo_lafalce.name, mateo_lafalce.email, mateo_lafalce.dni, mateo_lafalce.year, mateo_lafalce.male, mateo_lafalce.blockchain_knowledge)
}
Reference
この問題について(さび/Booleanos enさびにおけるブール類), 我々は、より多くの情報をここで見つけました https://dev.to/mateolafalce/booleans-in-rust-booleanos-en-rust-20m3テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol