If you in an age greater 18 the output still comes "too young" | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 3

If you in an age greater 18 the output still comes "too young"

I dont understand this

10th Feb 2018, 9:30 AM
Emmanuel
14 Antworten
+ 6
Run this code, it will output "Welcome"
10th Feb 2018, 9:36 AM
Tato
Tato - avatar
+ 5
Where? Can you link the code?
10th Feb 2018, 9:32 AM
Tato
Tato - avatar
+ 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"
10th Feb 2018, 9:40 AM
Tato
Tato - avatar
+ 4
in your code remove the line "age = 15"
10th Feb 2018, 9:43 AM
Tato
Tato - avatar
+ 4
You're welcome
10th Feb 2018, 9:44 AM
Tato
Tato - avatar
+ 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"
10th Feb 2018, 9:40 AM
Emmanuel
+ 1
ok.
10th Feb 2018, 9:33 AM
Emmanuel
+ 1
age = 15 if age > 18 puts "Welcome" else puts "Too young" end
10th Feb 2018, 9:33 AM
Emmanuel
+ 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
10th Feb 2018, 9:40 AM
Emmanuel
+ 1
this how i was doing it
10th Feb 2018, 9:40 AM
Emmanuel
+ 1
thanks a lot. @Tato
10th Feb 2018, 9:41 AM
Emmanuel
+ 1
ooh ok.
10th Feb 2018, 9:43 AM
Emmanuel
+ 1
ooow thats the problem ­čśÇ. thanks
10th Feb 2018, 9:44 AM
Emmanuel