a) else b) els c) if else d) None of the mentioned Answer: a Explanation: Else is valid conditional statement.
View Question
What is the output of the code?
variable=”true”.length
if variable
puts “true”
else
puts “false”
end
What is the output of the code? variable="true".length if variable puts "true"
View Question
What is the output of the code?
variable=true
if !variable
puts “true”
else
puts “false”
end
What is the output of the code? variable=true if !variable puts "true"
View Question
What is the output of the code?
variable=”true”.reverse
if variable
puts “true”
else
puts “false”
end
What is the output of the code? variable="true".reverse if variable puts ...
View Question
What is the output of the code?
variable=true
if variable
puts “true”
else
puts “false”
end
What is the output of the code? variable=true if variable puts ...
View Question
What is the output of the code?
if 1>2
puts “false”
end
else
puts “True”
end
What is the output of the code? if 1>2 puts "false" ...
View Question
What is the output of the given code?
if 1>2
puts “false”
else
puts “True”
What is the output of the given code? if 1>2 puts "false" ...
View Question
Is the following syntax correct?
if conditional
code…
elsif conditional
code..
else
code
end
Is the following syntax correct? if conditional code... elsif conditional
View QuestionWhat is the use of else statement?
a) When the if condition is false then the next else condition will get executed b) When the ...
View QuestionIt’s a good habit to give two spaces between if statement and condition.
a) True b) False Answer: a Explanation: Not necessary but good coders follow it.
View Question