Ruby
Rubyã®forãå§ãã¨ããç¹°ãè¿ãå¶å¾¡ã¯doï½endãç¹å¾´çãå¶å¾¡æ§é (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«)for.rbã§ãããæ¸ãã¨ã ãããªãããããªããSample/ruby/for/for/src/for at master · bg1bgst333/Sample · GitHub
*ãä»ããã¨ä½ã£ãè¦ç´ ãé åã¨ãã¦å ¥ãããæ¼ç®åå¼ (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«)multiple_assignment.rbã§ãããæ¸ãã¨ã ãããªãããããªããSample/ruby/multiple_assignment/multiple_assignment_1/src/multiple_assignment at master · bg1bgstâ¦
è¤æ°ã®å¤æ°ã«ãè¤æ°ã®å¤ãä»£å ¥ã§ãããæ¼ç®åå¼ (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«)multiple_assignment.rbã§ãããæ¸ãã¨ã ãããªããããªããSample/ruby/multiple_assignment/multiple_assignment/src/multiple_assignment at master · bg1bgst333/Samplâ¦
Hash.valuesã§å¤é åãåå¾åºæ¥ããclass Hash (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«)Hash.rbã§ãããæ¸ãã¨ã ãããªãããããªããSample/ruby/Hash/values/src/Hash at master · bg1bgst333/Sample · GitHub
Hash.keysã§ãã¼é åãåå¾åºæ¥ããclass Hash (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«)Hash.rbã§ãããæ¸ãã¨ã ãããªãããããªããSample/ruby/Hash/keys/src/Hash at master · bg1bgst333/Sample · GitHub
Hash.lengthã§Hashã®è¦ç´ æ°ãåå¾ãããRubyå ¥é - é åã»ããã·ã¥ã»ç¯å² - ã¨ã»ã»ã®WWWå ¥é class Hash (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«)Hash.rbã§ãããæ¸ãã¨ã ãããªãããããªããSample/ruby/Hash/length/src/Hash at master · bg1bgst333/Sample ·â¦
Array.shiftã§ãå é ããè¦ç´ ãåãåºããclass Array (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«)Array.rbã§ãããæ¸ãã¨ã ãããªããããªããSample/ruby/Array/shift/src/Array at master · bg1bgst333/Sample · GitHub
Array.unshiftã§ãå é ããæ¿å ¥ãããclass Array (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«)Array.rbã§ãããæ¸ãã¨ã ãããªãããããªããSample/ruby/Array/unshift/src/Array at master · bg1bgst333/Sample · GitHub
Array.popã§ãé åã®æ«å°¾ããè¦ç´ ãåãåºããclass Array (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«)Array.rbã§ãary1.popã§åãåºããeã¨ãã®å¾ã®ary1ãè¦ã¦ã¿ãã eã30ãary1ã10ã¨20ãeã30ãary1ã10ã¨20ãSample/ruby/Array/pop/src/Array at master · bg1bgâ¦
Array.pushã§ãé åã®æ«å°¾ã«è¦ç´ ã追å ãããclass Array (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«)Array.rbã§ãary1.pushã§40ã追å ã 確ãã«è¿½å ããã確ãã«è¿½å ããããSample/ruby/Array/push/src/Array at master · bg1bgst333/Sample · GitHub
Array.lengthã§ãé åã®è¦ç´ æ°(é·ã)ãåå¾ãããclass Array (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«) Rubyå ¥é - é åã»ããã·ã¥ã»ç¯å² - ã¨ã»ã»ã®WWWå ¥éArray.rbã§ãããæ¸ãã¨ã è¦ç´ æ°3ãåå¾åºæ¥ããè¦ç´ æ°3ãåå¾åºæ¥ããSample/ruby/Array/length/src/Arâ¦
å¤æ¬¡å é åãä½ããã¨ãã§ãããRubyå ¥é - é åã»ããã·ã¥ã»ç¯å² - ã¨ã»ã»ã®WWWå ¥éArray.rbã§ãããããã¨ã ãããªãããããªããSample/ruby/Array/multi_dimensional_Array/src/Array at master · bg1bgst333/Sample · GitHub
nilã¯æªå®ç¾©å¤ã表ããã¼ã¯ã¼ããRubyå ¥é - å¤æ°ã»å®æ° - ã¨ã»ã»ã®WWWå ¥énil.rbã§ã #!/usr/bin/ruby # ãã¼ã«ã«å¤æ°ãå¤ãå ¥ããã«åºå. puts var1ããã ã¨ã ã¨ã©ã¼ã«ãªã£ã¡ããã¨ã©ã¼ã«ãªã£ã¡ããã #!/usr/bin/ruby # ãã¼ã«ã«å¤æ°ã«å¤ãå ¥ãã¦åºå. vâ¦
ã¯ã©ã¹å ã§å®æ°ãå®ç¾©ããå ´åã<ã¯ã©ã¹å>::<å®æ°å>ã§å¤ããåç §ã§ãããRubyå ¥é - å¤æ°ã»å®æ° - ã¨ã»ã»ã®WWWå ¥éclass.rbã§ãã¨ããã¨ã ãããªãããããªããSample/ruby/class/class_const/src/class at master · bg1bgst333/Sample · GitHub
大æåã§å§ã¾ãèå¥åã¯å®æ°ãRubyå ¥é - å¤æ°ã»å®æ° - ã¨ã»ã»ã®WWWå ¥é å¤æ°ã¨å®æ° (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«) Ruby å®æ°ã«ã¤ã㦠- Qiita]const.rbã§ããããã¦ã¿ãã å¤æ´ä¸å¯ãã¨ãããããè¦åã®ã¿ã§å¤æ´ã¯ã§ãã¡ããã®ãã»ã»ã»ãå¤æ´ä¸å¯ãã¨â¦
$ã§å§ã¾ãå¤æ°ã¯ã°ãã¼ãã«å¤æ°ã§ãã©ãããã§ãã¢ã¯ã»ã¹ã§ãããRubyå ¥é - å¤æ°ã»å®æ° - ã¨ã»ã»ã®WWWå ¥évariable.rbã§ãã¨ããã ãããªããããªããSample/ruby/variable/global_variable/src/variable at master · bg1bgst333/Sample · GitHub
@@ã§å§ã¾ãå¤æ°ã¯ã¯ã©ã¹å¤æ°ã§ããã®ã¯ã©ã¹ã®ãã¹ã¦ã®ãªãã¸ã§ã¯ãã¤ã³ã¹ã¿ã³ã¹ããã®å¤æ°ãå ±æãã¦ãããRubyå ¥é - å¤æ°ã»å®æ° - ã¨ã»ã»ã®WWWå ¥éclass.rbã§ãobj1.setValueã§123ãã»ãããã¦ããããobj2.getValueã§ã123ãåå¾ã§ãããªãã@@valã¯å ±æâ¦
@ã§å§ã¾ãå¤æ°ã¯ã¤ã³ã¹ã¿ã³ã¹å¤æ°ã§ããªãã¸ã§ã¯ãã¤ã³ã¹ã¿ã³ã¹ãåå¨ããéã¯æå¹ã§ãããRubyå ¥é - å¤æ°ã»å®æ° - ã¨ã»ã»ã®WWWå ¥éclass.rbã§ã@valãã¤ã³ã¹ã¿ã³ã¹å¤æ°ãªã®ã§ããªãã¸ã§ã¯ããããéã¯å¤ãä¿æãããã ãããªããããªããSample/ruby/clasâ¦
newã«å¼æ°ã渡ããã.ãRubyãnewã¡ã½ããã¨initializeã¡ã½ããã®ä½¿ãæ¹ãã¯ã©ã¹ã¨ã¤ã³ã¹ã¿ã³ã¹ã | ãããã³ã¹ã¿ã¤ã«æ¸¡ãããå¼æ°ã¯ãinitializeã¡ã½ããã«æ¸¡ãããã®ã§ãããã§ä½¿ããã class.rbã§ãã¨ããã¨ã ãããªã ãããªããSample/ruby/class/new/â¦
newãå®è¡ãããæã«ãinitializeã¡ã½ãããå¼ã°ãããObject#initialize (Ruby 3.2 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«) Rubyå ¥é - ã¯ã©ã¹ - ã¨ã»ã»ã®WWWå ¥é ãRubyãnewã¡ã½ããã¨initializeã¡ã½ããã®ä½¿ãæ¹ãã¯ã©ã¹ã¨ã¤ã³ã¹ã¿ã³ã¹ã | ãããã³ã¹ã¿ã¤ã«class.rbã§â¦
classã§ã¯ã©ã¹ãå®ç¾©ãããRubyå ¥é - ã¯ã©ã¹ - ã¨ã»ã»ã®WWWå ¥éclass.rbã§ãã¨æ¸ãã TestClassã®obj.outputã«10ã渡ãã¨ããããåºåããããTestClassã®obj.outputã«10ã渡ãã¨ããããåºåããããSample/ruby/class/class/src/class at master · bg1bgsâ¦
returnã§ã¡ã½ããã®æ»ãå¤ãè¿ããRubyå ¥é - ã¡ã½ãã - ã¨ã»ã»ã®WWWå ¥édef.rbã§ãã¨æ¸ãã åå¾ãã10ãåºåãã¦ããåå¾ãã10ãåºåãã¦ããSample/ruby/def/return/src/def at master · bg1bgst333/Sample · GitHub
ã¡ã½ããã«å¼æ°ã渡ããRubyå ¥é - ã¡ã½ãã - ã¨ã»ã»ã®WWWå ¥édef.rbã§ãã¨æ¸ãã 渡ããã10ãåºåãã¦ãã渡ããã10ãåºåãã¦ããSample/ruby/def/argument/src/def at master · bg1bgst333/Sample · GitHub
'$'ãä»ãã¦ãªãå¤æ°ã¯ãã¼ã«ã«å¤æ°ãRubyå ¥é - å¤æ°ã»å®æ° - ã¨ã»ã»ã®WWWå ¥éã¡ã½ããã®ä¸ã§ä½¿ã£ã¦ãããã¼ã«ã«å¤æ°ã¯ãã¡ã½ããå¤ã¯ã¹ã³ã¼ãå¤ã variable.rbã§ãoutputVar1ã®ä¸ã®var1ã¯10ã outputVar1ãå¼ãã å¾ãputsã§ãvar1ãåºåã ä¸ã®var1ã¯ãã¹â¦
defã§ã¡ã½ãã(ããã§ã¯ã¯ã©ã¹ã¡ã½ããã§ã¯ãªããåç¬ã®é¢æ°ãæãã)ãå®ç¾©ãããRubyå ¥é - ã¡ã½ãã - ã¨ã»ã»ã®WWWå ¥édef.rbã§ãããæ¸ãã ã¡ã½ãããå¼ã°ããã¡ã½ãããå¼ã°ãããSample/ruby/def/def/src/def at master · bg1bgst333/Sample · GitHub
ã³ã¡ã³ãã®æ¸ãæ¹ã¯ãPerlãPythonã¨åããã'#'ã使ããRubyå ¥é - æ§æ - ã¨ã»ã»ã®WWWå ¥écomment.rbã§ãããæ¸ãã æåã³ã¼ããutf-8ã§ã¯ãªãã£ãã®ã§ãutf-8ã§ä¿åãæåã³ã¼ããutf-8ã§ã¯ãªãã£ãã®ã§ãutf-8ã§ä¿åã ããåºåããããã³ã¡ã³ãã¯åºåâ¦
Rubyããã¢ããã¥ã¡ã³ãã使ãããRubyå ¥é - æ°å¤ã»æååã»å - ã¨ã»ã»ã®WWWå ¥éhere_document.rbã§ãã¨æ¸ãã ãã®ããã«è¡¨ç¤ºãããããã®ããã«è¡¨ç¤ºããããSample/ruby/here_document/here_document/src/here_document at master · bg1bgst333/Sample ·â¦
ã³ãã³ããããã¯ã¯ã©ã¼ã(``)ã§å²ãã¨ããã®ã³ãã³ããå®è¡ããçµæã®åºåãè¿ãã¦ããããRubyå ¥é - æ°å¤ã»æååã»å - ã¨ã»ã»ã®WWWå ¥écommand_execution.rbã§ãpwdã³ãã³ããå®è¡ããçµæãå¾ãã ããã°ã©ã ã®ããå ´æã§å®è¡ããæã®ä½ç½®ã«ãªãããã°â¦
以åæ¸ãããã©ãRubyã®å ´åã¯ã"#{"ã¨"}"ã§å²ããã¨ã§å¤æ°ãé åãå±éã§ããããããããããã¯å¼ãå±éã§ããã®ã§ããããªãã©ã« (Ruby 3.1 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«) Rubyå ¥é - æ°å¤ã»æååã»å - ã¨ã»ã»ã®WWWå ¥éãªã®ã§ãããããã¨ã ãããããã®ãâ¦
ããã·ã¥ãçµã¿è¾¼ã¿ã©ã¤ãã©ãªHashã¨ãã¦ç¨æããã¦ãããclass Hash (Ruby 2.7.0 ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«) Rubyå ¥é - é åã»ããã·ã¥ã»ç¯å² - ã¨ã»ã»ã®WWWå ¥éRubyã ã¨ãæååã ãã§ãªããã·ã³ãã«(Perlã§ããã·ã³ããªãã¯ãªãã¡ã¬ã³ã¹?)ããã¼ã«åºæ¥ããâ¦