Logical Type
Logical data type can store only two values: TRUE (or T) and FALSE (or F). These values are case-sensitive and are used to evaluate conditions and expressions.
Comparisons
Comparisons such as equality or greater-than tests produce logical results. These results are always either TRUE or FALSE.
Example
122 > 1 5 == 10
Type Conversions
- Number into logical:
0becomesFALSE, while any non-zero number becomesTRUE; - String into logical:
'F','false','False','FALSE'convert toFALSE;'T','true','True','TRUE'convert toTRUE;- Other values are converted into
NA;
- Logical into number:
FALSEbecomes0andTRUEbecomes1.
Swipe to start coding
- Assign the result of the expression
19*54 > 76*13to the variablelogic. - Show the value of the
logicvariable. - Show the data type of the
logicvariable. - Convert the
logicvariable to an integer and show the result.
Avoid using the print() function.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Чудово!
Completion показник покращився до 2.27
Logical Type
Свайпніть щоб показати меню
Logical data type can store only two values: TRUE (or T) and FALSE (or F). These values are case-sensitive and are used to evaluate conditions and expressions.
Comparisons
Comparisons such as equality or greater-than tests produce logical results. These results are always either TRUE or FALSE.
Example
122 > 1 5 == 10
Type Conversions
- Number into logical:
0becomesFALSE, while any non-zero number becomesTRUE; - String into logical:
'F','false','False','FALSE'convert toFALSE;'T','true','True','TRUE'convert toTRUE;- Other values are converted into
NA;
- Logical into number:
FALSEbecomes0andTRUEbecomes1.
Swipe to start coding
- Assign the result of the expression
19*54 > 76*13to the variablelogic. - Show the value of the
logicvariable. - Show the data type of the
logicvariable. - Convert the
logicvariable to an integer and show the result.
Avoid using the print() function.
Рішення
Дякуємо за ваш відгук!
single