0
Are if statements can only be used for numbers?
I wanted to make a program that if I ask questions then can I use if statement
6 odpowiedzi
+ 10
No, if stmts are not limited to comparing numbers
Pls tag ur programming language..
+ 5
If statements only accept boolean variable and expressions, not others.
You need to perform comparison to generate a valid expression.
i = 4 > 5
#false
+ 1
Yes you can
+ 1
No. You could use it also with string. Example:
var test = "Hello";
if (test == "Hello") {
print("Success");
}
0
No. We could also use them for words. Example: if x == "Hello":
print("Success")
0
https://code.sololearn.com/cyjh8S6LxnMm/?ref=app
In this code, I used if statements involving not only numbers, but also words