Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
Ruby
Statement 116 codes
Home
Ruby
Statement
1 A downto iterator, which starts at a higher number and loops to a lower number
2 Add the even numbers from 4 to 12
3 All Ruby expressions return a result
4 Although do and end are encouraged for multiple-line code blocks, curly brackets make the code easier to read on a single line.t
5 An if statement with an else clause looks like in general (the else clause is optional)
6 Another form you can use is with beginend
7 As unless is a negated form of if, until is really a negated form of while
8 Basic way to implement a loop
9 Begin
10 Both the Integer and Date classes have downto methods
11 Break ends the immediately enclosing loop
12 Break if
13 Break out of a block
14 C++, Java, and Ruby exception handling compared
15 Case when with range
16 Case with regular expression
17 Catch and Throw
18 Catch and throw dont have to be directly in the same scope
19 Change the order
20 Conditional Statements
21 Do all the times tables from 1 to 12
22 Do calculation in times block
23 Downto method with integer
24 Downto with block
25 Elsif and case
26 Example of upto that prints out a times table for 2
27 Execution Before or After a Program
28 For each element in a range
29 For each element in an array
30 For each item in
31 General form of the for loop
32 Handling Exceptions
33 Handling Passed Exceptions
34 Heres the formal specification for the until loop
35 Heres the formal specification for the while loop
36 Heres the general format of the Ruby case statement
37 How exceptions work in Ruby
38 If and unless also supply the else condition
39 If statement contains several elsif statements
40 If the value of age is under 18, the string is printed to the screen
41 If vs Case
42 Include their code in other files with the Ruby include statement
43 Interpolation with upto and array
44 Iterating Through Blocks
45 Lay out an if statement is by replacing the then with a colon (
46 Like if, you can use while as a statement modifier, at the end of a statement
47 Like while, you have another form you can use with untilathat is, with beginend
48 Loop code based on the result of a comparison made on each loop
49 Nest if logic
50 Nested for loop
51 Next Skips to the end of the current iteration (which makes the loop or iterator skip on to the next iteration or item)
52 Number of minutes you want to count down
53 One date may upto another
54 Output based on if statement
55 Put any number of lines of code in between the if statement and the end line
56 Raise ArgumentError
57 Raise exception from constructor
58 Raise IndexError
59 Raise one on your own with the raise method from Kernel
60 Raising Exceptions
61 Read till quit
62 Redo Repeats the current loop iteration (without reevaluating the loops condition or getting the next item from an iterator)
63 Repeating and Making Choices
64 Replace one array with another
65 Rescue an exception
66 Rescues syntax makes handling different exceptions in different ways easy
67 Retry restarts the iteration
68 Stopping an Iteration
69 Syntax of the full unless statement
70 Syntax of using elsif Clauses in if Statements
71 Test for equality
72 The code in a block labeled END is automatically run when the program finishes
73 The code in a block labeled with the keyword BEGIN is run automatically when a Ruby program is loaded
74 The if Statement with constant
75 The loop Method
76 The retry statement will start a loop or iterator over entirely
77 The simple form of an if statement looks like this
78 The times Method and for loop
79 The upto Method and for loop
80 The while Loop
81 The while loop executes its contained code while a condition that you specify remains true
82 Throw a symbol out
83 Throw sends a message to catch if n is less than or equal to 0
84 To get the opposite effect of if you can use the word unless
85 To iterate a set number of times, use the times iterator
86 Unless and until
87 Unless can work in exactly the same way because unless is just the opposite of if
88 Unless statement simply operates in the logically reverse sense from the if statement
89 Until keeps looping while its condition remains false, or not true
90 Until loops until a certain condition is met
91 Upto with without {}
92 Use a case statement to make an assignment, which omits the value to test
93 Use a value in a variable with times
94 Use an elsif Clause
95 Use an upto Iterator to reference array element
96 Use curly braces ({})
97 Use exculsive ranges in case statements
98 Use for to loop through array index
99 Use if statement to check the user input
100 Use the ! logical negation operator
101 Use the if Statement
102 Use the multiline ifelse option
103 Use the upto iterator, which is what traditional for loops translate into in Ruby
104 Use while and until in a single line setting, as with if and unless
105 Use while as a Loop Modifier
106 Use while loop to convert elements in an array to capitalized case
107 Uses the upto iterator to create a loop similar to a for loop from other languages
108 Using else Clauses in if Statements
109 Using if as a modifier with Boolean operator
110 Using the case Statement
111 Using the for Loop
112 Using unless as Modifiers
113 Using unless as Modifiers with boolean operator
114 We dropped then from the if statement
115 While loop with array length
116 Write elsif statement a little tighter by using colons after the symbols