LoginSignup
1
1

More than 5 years have passed since last update.

動的型付けと静的型付け

Posted at

静的型付け

変数を宣言する時、その変数のデータ型が実行前に決まるのが静的型付け。
データ型とはデータの種類を表すもの。String(文字列)やBoolean(真偽値)とか
CやJava、Goとかがそうらしい

C言語だとこんなかんじ

test.c
#include <stdio.h>

int main(void) {
  int value; //int型(整数)でvalueという変数を宣言
  return 0;
}

動的型付け

静的型付けに対して、変数宣言時に型を示す必要がない。
プログラムの実行時に変数に入るデータの型が動的に変わる。
P言語やRubyは動的型付け

Rubyだと

test.rb
value = "hogehoge"
1
1
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
1
1