view test/octave.test/switch/switch-2.m @ 6971:0a9d97cf2e13

[project @ 2007-10-07 19:44:53 by dbateman]
author dbateman
date Sun, 07 Oct 2007 19:44:53 +0000
parents 31f6943ed944
children
line wrap: on
line source

a = 1;
b = 2;
c = 3;

x = zeros (1, 4);

k = 1;

for i = 0:3
  switch (i)
    case a
      x(k) = a;
    case b
      x(k) = b;
    otherwise
      x(k) = c;
  endswitch
  k++;
endfor

all (x == [3, 1, 2, 3])