Important! This is an automatic machine translated page. If you can read english, you should Click Here to read the original English version of the article.

Ruby If, Else If Command Syntax Ruby Jeżeli else if poleceń Składnia

The Ruby language has a very simple control structure that is easy to read and follow. Języka Ruby posiada bardzo prostą strukturę kontroli, które są łatwe do odczytania i przestrzegać ich.

If syntax Jeśli składni

if var == 10 jeśli var == 10
print “Variable is 10″ print "Zmienna jest 10"
end koniec

If Else Syntax Jeśli inne Składnia

if var == 10 jeśli var == 10
print “Variable is 10″ print "Zmienna jest 10"
else w przeciwnym razie
print “Variable is something else” print "Zmienna to coś innego"
end koniec

If Else If Syntax Jeśli inne Jeśli Składnia

Here's the key difference between Ruby and most other languages. Oto kluczowa różnica między Ruby i większość innych języków. Note that “else if” is actually spelled “elsif” without the e. Zauważ, że "else if" jest rzeczywiście pisana "elsif" bez e.

if var == 10 jeśli var == 10
print “Variable is 10″ print "Zmienna jest 10"
elsif var == “20″ elsif var == "20"
print “Variable is 20″ print "Zmienna jest 20"
else w przeciwnym razie
print “Variable is something else” print "Zmienna to coś innego"
end koniec

Ternary (shortened if statement) Syntax Pieśń (skrócony if) Składnia

Ternary syntax is the same in Ruby as most languages. Pieśń składnia jest taka sama w Ruby w większości języków. The following sample will print “The variable is 10″ if var is equal to 10. W następującym przykładzie zostanie wydrukowana "zmienna jest 10" Jeśli parametr jest równy 10. Otherwise it will print “The variable is Not 10″. W przeciwnym razie będzie to print "zmienna jest nie 10".

print “The variable is ” + (var == 10 ? “10″ : “Not 10″) print "zmienna jest" + (var == 10 "10": "nie 10")

This article was originally written on 11/1/09 Tagged with: Ten artykuł został napisany na 11/1/09 Tagged with: Ruby Ruby

Daily Email Updates Daily Email Updates

You can get our how-to articles in your inbox each day for free. Możesz pobrać nasze instrukcje postępowania w skrzynce odbiorczej codziennie za darmo. Just enter your name and email below: Wystarczy podać swoje imię i adres e-mail:


Name: Imię i nazwisko:
Email: E-mail:

Leave a Comment Zostaw komentarz




Leave your Zostaw swój friendly przyjazny comment here. komentarz.

If you have a computer help question, Jeśli masz pytanie pomocy komputera, click here to leave it on the forums Kliknij tutaj, aby pozostawić ją na forum instead. zamiast.

Note: Your comment may not show up immediately on the site. Uwaga: Twój komentarz nie pojawi się od razu na stronie.

Our Friends Nasi Przyjaciele
Getting Started Pierwsze kroki


About How-To Geek O How-To Geek
What Is That Process? Co to jest proces?
svchost.exe svchost.exe
jusched.exe jusched.exe
dwm.exe dwm.exe
ctfmon.exe Gadu-Gadu
wmpnetwk.exe wmpnetwk.exe
wmpnscfg.exe wmpnscfg.exe
rundll32.exe rundll32.exe
wfcrun32.exe wfcrun32.exe
Ipoint.exe Ipoint.exe
Itype.exe Itype.exe
Wfica32.exe Wfica32.exe
Mobsync.exe Mobsync.exe
conhost.exe conhost.exe
Dpupdchk.exe Dpupdchk.exe Adobe_Updater.exe Adobe_Updater.exe

Copyright © 2006-2009 HowToGeek.com. Copyright © 2006-2009 HowToGeek.com. All Rights Reserved. All Rights Reserved.