0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

naming > 範囲 > inclusive / exclusive

Last updated at Posted at 2016-06-07

関連 https://en.wikipedia.org/wiki/Interval_(mathematics)

ある数値範囲 [0,90)の0,90の値を保持する変数名の検討。

@ Readable Code (Kindle Edition @ No.1151)

Prefer begin and end for Inclusive/Exclusive Ranges

a b c d
begin end

上記のような例で使われているが以下のようにも記載している。

But the word end is a little ambiguous. For example, in the sentence, "I'm at the end of the book," the "end" is inclusive.

endを使うと数年後にソースリーディングしにくくなりそうだ。

Fortran

不等号に使うものがある

参考 http://www.math.hawaii.edu/~hile/fortran/fort2.htm

  • .ge.
  • greater than or equal to
  • .lt.
    • less than

個人的にはge,ltでわかるが、Fortranを使わない人にはわからない。

アイデア

以下だとソース内で意味がわかりやすい

  • min_inclusive / max_exclusive

とりあえずこれで作りながらもう少しよい名前を検討する

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?