変数の初期化コードをローカルスコープに入れる

  • 関数にするほどでもない時に。


[]// C[]
[]int[] []x[][], [][]a[][], [][]b[][];[]
[]a[][] = [][]f[][]();[]
[]b[][] = [][]g[][]([][]a[][]);[]
[]x[][] = [][]h[][]([][]b[][]);[]

[]// C++ ?[]
[]int[] []a[][] = [][]f[][]();[]
[]int[] []b[][] = [][]g[][]([][]a[][]);[]
[]int[] []x[][] = [][]h[][]([][]b[][]);[]

[]// learn new things from C[]
[]int[] []x[][]; {[]
[]// if x is well named, you can skip reading this scope![]
[]int[] []a[][] = [][]f[][]();[]
[]int[] []b[][] = [][]g[][]([][]a[][]);[]
[]x[][] = [][]h[][]([][]b[][]);[]
[]}[]