• ≡ Menu
  • Contact
  • Sitemap
  • Advertise
  • Submenu
    • Submenu 1
    • Submenu 2
    • Submenu 3
    • Submenu 4
    • Submenu 5
  • Submenu
    • Submenu 1
    • Submenu 2
    • Submenu 3
    • Submenu 4
    • Submenu 5
  • Submenu
    • Submenu 1
    • Submenu 2
    • Submenu 3
    • Submenu 4
    • Submenu 5

yellow

Menu
  • Home
  • MENU TITLE
    • LABEL NAME
    • fatima
    • LABEL NAME
  • MENU TITLE
    • LABEL NAME
    • LABEL NAME
    • fox mux
  • Normal Link
  • Search form is empty!

Linux Ruby If, Else If Command Syntax

Ruby If, Else If Command Syntax



The Ruby language has a very simple control structure that is easy to read and follow.

If syntax
if var == 10
print “Variable is 10”
end

If Else Syntax
if var == 10
print “Variable is 10”
else
print “Variable is something else”
end

If Else If Syntax
Here’s the key difference between Ruby and most other languages.
Note that “else if” is actually spelled “elsif” without the e.

if var == 10
print “Variable is 10”
elsif var == “20”
print “Variable is 20”
else
print “Variable is something else”
end


Ternary (shortened if statement) Syntax

Ternary syntax is the same in Ruby as most languages. The following sample will print “The variable is 10” if var is equal to 10.
Otherwise it will print “The variable is Not 10”.

print “The variable is ” + (var == 10 ? “10” : “Not 10”)
wh76
Add Comment
Linux
Tuesday, July 26, 2016
  • Tweet
  • Share
  • Share
  • Share
  • Share

About Admin

This is dummy text. It is not meant to be read. Accordingly, it is difficult to figure out when to end it. But then, this is dummy text. It is not meant to be read. Period.

Related Posts

Comments
0 Comments

Share

Tweet

Weekly Posts

  • InstaShow v1.4.1 - WordPress Instagram Gallery Widget
    InstaShow v1.4.1 - WordPress Instagram Gallery Widget
    InstaShow is a premium Instagram widget for creating charming galleries of Instagram images. Take the advantage of an all-new multipurpose G...
  •  Beverly Script UPDATED - Creativemarket 294884
    Beverly Script UPDATED - Creativemarket 294884
    Beverly Scr UPDATED - Creativemarket 294884 OTF, WOFF, JPG | Web font | 2.5 Mb This is a wonderful font drawn by hand and with love! Beve...
  • GPS Navigation&Maps Sygic16.0.16
    GPS Navigation&Maps Sygic16.0.16
    GPS Navigation & Maps Sygic 16.0.16 Final FULL | 205 MB Sygic: GPS Navigation & Maps is The Worlds Most Installed Offline turn-by-tu...
  •  Why Do x86 CPUs Only Use Two Out of Four “Rings”?
    Why Do x86 CPUs Only Use Two Out of Four “Rings”?
    When learning more about how operating systems and the hardware they run on work and interact with each other, you may be surprised to see ...
  • Complete Website Theme, HTML CSS PSD - Creativemarket 531499
    Complete Website Theme, HTML CSS PSD - Creativemarket 531499
    Complete Website Theme, HTML CSS PSD - Creativemarket 531499 Jordan Mike Theme is a minimalistic and responsive website theme. It's full...
  • Ratiborus KMS Tools 25.04.2016
    Ratiborus KMS Tools 25.04.2016
    Ratiborus KMS Tools 25.04.2016 Portable | 16.8 MB All-in-one collection of activators from Ratiborus for Windows XP, Vista, 7, 8, 8.1, 10, ...
  • Switch MySQL to listen on " TCP"
    Switch MySQL to listen on " TCP"
    By default, MySQL only allows connections from the localhost address. The configuration file is usually found in /etc/mysql/my.cnf You w...
  • The GM Guide to Upgrading Your Computer to USB 3.0
    The GM Guide to Upgrading Your Computer to USB 3.0
    Whether you’re sporting an older computer without a single USB 3.0 port or you’d like to expand and improve the roster of USB 3.0 ports on ...
  • Beginner GM: How to Pair Devices Over Bluetooth
    Beginner GM: How to Pair Devices Over Bluetooth
    Wireless devices with Bluetooth radios must be “paired” with each other before they can communicate. This involves making them discoverable...
  • Mountain Trap 2: Under the Cloak of Fear [vFinal-Updated]
    Mountain Trap 2: Under the Cloak of Fear [vFinal-Updated]
    Mountain Trap 2: Under the Cloak of Fear In the exciting sequel to the Mountain Trap series, a trip to the mysterious town of Wilshere r...

Label

Android AndroidGames Apple Ebooks Flac Gadgets Graphics Hardware Jazz Linux MakeMoney Office PCGames Script Templates TipsBlogger Windows

Visitor

Sparkline

Subscribe Box

Contact

Name

Email *

Message *

Copyright yellow 2014-2015
Created by Arlina Design