Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

asdsad

# Hello World Program in Ruby

#迴圈是從 1到30
for x in 5..10
  if x % 10 == 0
    puts "因為 #{x} 符合了能被10整除 所以就不往下"
    puts "不然 #{x} 也能被5整除 沒餘數的"
    puts "從上往下閱讀 先中的符合 就不在往下執行"
    puts "==========================="
  elsif x % 5 == 0
    puts "該數字為 #{x} 能被5整除 餘數0"
    puts "==========================="
  end
end

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.