1. TOP
  2. プログラム
  3. ソフト
  4. python
  5. RとPython-p24

RとPython-p24

条件分岐

if 条件式:
    条件を満たした時の実行する
else:
    条件を満たさなかった時に実行する処理

python

a = 3
if a == 3:
    print('a is 3')
else:
    print('a is not 3')

R

a <- 3
if (a == 3){
    print('a is 3')
} else {
    print('a is not 3')
}