Post Reply 
What Was Your First Programming Language?
07-09-2015, 12:14 PM
Post: #99
RE: What Was Your First Programming Language?
(07-09-2015 06:42 AM)Thomas Klemm Wrote:  
(07-09-2015 01:55 AM)Sylvain Cote Wrote:  
Code:
print "Too high!" if ($guess > $number);
print "Too low!" if ($guess < $number);

Or then using the ternary operator ?:
Code:
print $guess > $number ? "Too high!" : "Too low!";

Right, but to respect the same logic your line will have to modified like this
Code:
print $guess > $number ? "Too high!" : $guess < $number ? "Too low!" : "";
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: What Was Your First Programming Language? - Sylvain Cote - 07-09-2015 12:14 PM



User(s) browsing this thread: 1 Guest(s)