Difference between revisions of "Упражнение 3. Matlab"

From Ilianko
(Created page with "== Управляващи оператори == === if == <code><pre> if <expression> statment end if <expression> statement; else statement; end if <expression> statemen...")
 
Line 1: Line 1:
 
== Управляващи оператори ==
 
== Управляващи оператори ==
  
=== if ==
+
=== if ===
 
<code><pre>
 
<code><pre>
 
if <expression>
 
if <expression>
Line 22: Line 22:
 
</pre></code>
 
</pre></code>
  
== Релации и логически оператори ==
+
=== Релации и логически оператори ===
 
< , <= , >, >= , ~=, ==
 
< , <= , >, >= , ~=, ==
  
 
&, &&, |, ||, ~
 
&, &&, |, ||, ~
  
 +
=== switch ===
 +
switch expression
 +
  case val1
 +
    statement
 +
  case {val2, val3
 +
    statement
  
 
+
  otherwise
 +
    statement
 +
end
  
 
[[Category:Matlab]]
 
[[Category:Matlab]]

Revision as of 11:26, 15 April 2011

Управляващи оператори

if

if <expression>
  statment
end

if <expression>
 statement;
else
 statement;
end

if <expression>
 statement;
elseif
 statement;
else
 statement;
end

Релации и логически оператори

< , <= , >, >= , ~=, ==

&, &&, |, ||, ~

switch

switch expression
 case val1
   statement
 case {val2, val3
   statement
 otherwise
   statement
end