Hello, Reader ^^! Back again with source code. This time is a basic syntax Case in Ruby programming language. This source code is to show how to do Case statement in Ruby language. Here's the template:
case <variable name>
when <variable condition 1> then
<statement 1 if variable fulfills condition 1>
when <variable condition 2> then
<statement 2 if variable fulfills condition 2>
when <variable condition 3> then
<statement 3 if variable fulfills condition 3>
when <variable condition N> then
<statement N if variable fulfills condition N>
else (optional)
<statement if variable doesn't fulfill any condition>
end
Note: "else" is optional
Okay, that's all I can say. Thank you for reading ^^!
No comments:
Post a Comment