+ 3
If you in an age greater 18 the output still comes "too young"
I dont understand this
14 Antworten
+ 6
Run this code, it will output "Welcome"
+ 5
Where? Can you link the code?
+ 4
The difference is in the first line
Depending on the value of variable "age", the output is different.
If age is greater than 18 it will say "Welcome", otherwise - "Too young"
+ 4
in your code remove the line "age = 15"
+ 4
You're welcome
+ 2
oohk. it came. can you help me on this: if you enter less than 18 the output should be "less than 18" n if its above 18 "good to go"
+ 1
ok.
+ 1
age = 15
if age > 18
puts "Welcome"
else
puts "Too young"
end
+ 1
puts "Enter name"
name = gets.chomp
puts "You are welcome, #{name}"
puts "Enter age"
name = gets.chomp
age = 15
if age > 18
puts "Welcome"
else
puts "Too young"
end
+ 1
this how i was doing it
+ 1
thanks a lot. @Tato
+ 1
ooh ok.
+ 1
ooow thats the problem 😀. thanks