Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Picasoft
APIs
Init
Sh
Commits
d4a6dc9f
Unverified
Commit
d4a6dc9f
authored
Jan 17, 2019
by
Rémy Huet
💻
Browse files
Arithmétique
parent
87284438
Pipeline
#33590
passed with stage
in 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/tex/variables.tex
View file @
d4a6dc9f
...
...
@@ -134,3 +134,54 @@ echo ``Salut $nom''
\end
{
Verbatim
}
\end
{
beamercolorbox
}
\end
{
frame
}
\begin
{
frame
}
[
fragile
]
{
Les opérations arithmétique
}
\begin
{
block
}{
Contexte
}
Bash ne gère pas nativement les variables comme des nombres
(
2
+
2
donnera une erreur
)
. Il faut passer par la commande
\texttt
{
let
}
\end
{
block
}
Exemple :
\begin
{
beamercolorbox
}
[
rounded
=
true,shadow
=
true
]
{
terminal
}
\begin
{
Verbatim
}
let ``a
=
5
''
let ``b
=
2
''
let ``c
=
a
+
b''
echo
$
c
\end{Verbatim}
\end{beamercolorbox}
Quand on execute le script, on obtient :
\begin{beamercolorbox}
[rounded=true,shadow=true]
{
terminal
}
\begin{Verbatim}
remy@hp-remy:~/scripts
$
.
/
script.sh
\Pause
8
\end
{
Verbatim
}
\end
{
beamercolorbox
}
\end
{
frame
}
\begin
{
frame
}{
Les opérateurs arithmétiques
}
Les opérateurs reconnus par
\texttt
{
let
}
sont :
\begin
{
table
}
\centering
\begin
{
tabular
}{
|c|c|c|
}
\hline
{
\bf
Symbole
}
&
{
\bf
Signification
}
&
{
\bf
Exemple
}
\\
\hline\hline
\texttt
{
+
}
&
Addition
&
\texttt
{
5
+
2
=
7
}
\\
\hline
\texttt
{
-
}
&
Soustraction
&
\texttt
{
5
-
2
=
3
}
\\
\hline
\texttt
{
*
}
&
Multiplication
&
\texttt
{
5
*
2
=
10
}
\\
\hline
\texttt
{
/
}
&
Division euclidienne
&
\texttt
{
5
/
2
=
2
}
\\
\hline
\texttt
{
**
}
&
Puissance
&
\texttt
{
5
**
2
=
25
}
\\
\hline
\texttt
{
\%
}
&
Modulo
&
\texttt
{
5
\%
2
=
1
}
\\
\hline
\end
{
tabular
}
\caption
{
Les opérateurs de let
}
\label
{
tab:operators
}
\end
{
table
}
\begin
{
exampleblock
}{
Info
}
Comme en c, il est possible d'utiliser la syntaxe
\texttt
{
let ``a
*=
3
''
}
à la place de
\texttt
{
let ``a
=
a
*
3
''
}
{
\tiny\it
(
ou autres opérateurs
)
}
\end
{
exampleblock
}
\end
{
frame
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment