📜  红宝石 |符号下一个函数

📅  最后修改于: 2022-05-13 01:55:32.627000             🧑  作者: Mango

红宝石 |符号下一个函数

Symbol#next() : next()是一个 Symbol 类方法,它返回下一个符号对象。

示例 #1:

# Ruby code for Symbol.next() method
  
# declaring Symbol 
a = :aBcDeF
  
# declaring Symbol
b = :"\u{e4 f6 fc}"
  
# declaring Symbol
c = :ABCDEF
  
# Symbol 
puts "Symbol a : #{a}\n\n"
puts "Symbol b : #{b}\n\n"
puts "Symbol c : #{c}\n\n\n\n"
  
  
# next form 
puts "Symbol a next form : #{a.next}\n\n"
puts "Symbol b next form : #{b.next}\n\n"
puts "Symbol c next form : #{c.next}\n\n"

输出 :

Symbol a : aBcDeF

Symbol b : äöü

Symbol c : ABCDEF



Symbol a next form : aBcDeG

Symbol b next form : äöý

Symbol c next form : ABCDEG

示例 #2:

# Ruby code for Symbol.next() method
  
# declaring Symbol 
a = :geeks
  
# declaring Symbol
b = :"\u{e5 f6 f3}"
  
# declaring Symbol
c = :GEEKS
  
# Symbol 
puts "Symbol a : #{a}\n\n"
puts "Symbol b : #{b}\n\n"
puts "Symbol c : #{c}\n\n\n\n"
  
  
# next form 
puts "Symbol a next form : #{a.next}\n\n"
puts "Symbol b next form : #{b.next}\n\n"
puts "Symbol c next form : #{c.next}\n\n"

输出 :

Symbol a : geeks

Symbol b : åöó

Symbol c : GEEKS



Symbol a next form : geekt

Symbol b next form : åöô

Symbol c next form : GEEKT