LoginSignup
4
0

More than 3 years have passed since last update.

マルチスケールシミュレーション特論:第 5 回をまとめてみた

Last updated at Posted at 2020-11-18

!ruby-2.5.5p157

ruby 構文(hello world)

はじめに

どんなプログラミング言語もまず始めは hello world から始めるものなので hello world を通して様々な出力用の関数を覚えていく

Strings を打ち出す方法

まず初心者の人は基本として以下のどれかを覚えておけばよい

  • print: 改行が必要
  • puts: 自動改行をしてくれる
  • p: coding の最中に debug がわりに打ち出すとき
  • pp: p の pretty print, require 'pp'が必要
  • printf: format を整えるときに便利

上記の中で私はよく python を使うので慣れている、~print~ を使う事にする

print の使い方について

print には改行が必要なので以下のように改行用の文字(\n)が必要となる

print "Hello " + ARGV[0] + "\n"

  • source ~/Downloads/git/grad_members_20f/members/taiseiyo/memos/class5.org
4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0