• ≡ 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

شارع

Menu
  • Static Page
  • Dropmenu
    • Dropmenu 1
    • Dropmenu 2
    • Dropmenu 3
    • Dropmenu 4
    • Dropmenu 5
  • Button
  • Dropmenu
    • Dropmenu 1
    • Dropmenu 2
    • Dropmenu 3
    • Dropmenu 4
    • Dropmenu 5
  • Error
  • Surprise Me
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
Monday, March 21, 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

Follow on FaceBook

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...
  • How to Sync Contacts, Reminders, and More with iCloud
    How to Sync Contacts, Reminders, and More with iCloud
    If you use a Mac, iPhone, or iPad, you might have wondered what iCloud is using all that space for. Today, we’ll take you through the entir...
  • Responsive CSS Timeline with 3D Effect for Blogger
    Responsive CSS Timeline with 3D Effect for Blogger
    Here's another amazing way to display our Blogger posts. By applying the following Responsive CSS Timeline View with 3D Effect on Blogge...
  • How to Install Fallout 4 Mods with Nexus Mod Manager
    How to Install Fallout 4 Mods with Nexus Mod Manager
    Like Skyrim and other Bethesda games before it, modding is one of Fallout 4’s huge draws on the PC. But Fallout 4 and Steam don’t offer an e...
  • How to Turn off “OK Google” on Your Android Device
    How to Turn off “OK Google” on Your Android Device
    “Ok Google” is cool because it just works. The hands-free search activation installed on the vast majority of Android devices makes looking ...
  • Fast Food Tri-Fold Brochure PSD Template
    Fast Food Tri-Fold Brochure PSD Template
    Fast Food Tri-Fold Brochure PSD Template PSD | 1275x1875 PIX | 14,73 MB DOWNLOAD
  • How to Reboot or Factory Reset Your Google Chromecast
    How to Reboot or Factory Reset Your Google Chromecast
    Google changed the device-to-TV scene with Chromecast, but as with all technology, it can have problems. At some point, you may need to rebo...
  • How to Disable iCloud Photo Syncing in OS X Photos
    How to Disable iCloud Photo Syncing in OS X Photos
    Apple has finally taken the wraps off its iPhoto successor: Photos. It’s great so far, but we’re not sure everyone is going to be thrilled ...
  •  26 Actually Useful Things You Can Do with Siri
    26 Actually Useful Things You Can Do with Siri
    Siri is best known as Apple’s so-called digital personal assistant available on iOS devices like iPhone and iPad. Some might think Siri is o...
  • Resume, Cover Letter & Portfolio - Creativemarket 44692
    Resume, Cover Letter & Portfolio - Creativemarket 44692
    Resume, Cover Letter & Portfolio - Creativemarket 44692 8 INDD, 8 INDT, 8 INDL | A4 Paper Size | Fully Editable | CMYK Ready, 300 dpi |...

Label

Android Android Games Apple Blogger Ebooks Flac Gadgets Graphics Hardware Jazz Linux MakeMoney Mobiles Office PC Games Script suf Templates Windows

Visitor

Sparkline

Subscribe Box

Contact

Name

Email *

Message *

Copyright شارع 2014-2015
Created by Arlina Design