From 25b6f1d9249d260d392e0ddd4c6887bebf842b50 Mon Sep 17 00:00:00 2001 From: Michael Kane Date: Sat, 1 Dec 2018 12:41:31 -0600 Subject: [PATCH] Add example of Ternary Operator (#25553) --- guide/english/ruby/ruby-conditionals/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/guide/english/ruby/ruby-conditionals/index.md b/guide/english/ruby/ruby-conditionals/index.md index 6003a49716c..89809e9d0e4 100644 --- a/guide/english/ruby/ruby-conditionals/index.md +++ b/guide/english/ruby/ruby-conditionals/index.md @@ -34,6 +34,8 @@ The above statement equal to the statement below ``` ## Ternary Statement A ternary statement is used as a short conditional statement. It is written as follows + + *variable = condition ? true_result : false_result* * ```ruby game = "won" fans = game == "won" ? "happy" : unhappy @@ -52,4 +54,4 @@ A case statement is similar to an if/elsif/else statement else puts "This is not an apple or an orange" end - ``` \ No newline at end of file + ```