Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

astuce, raccourci, pattern, bref simplification pour 4 coins

21 réponses
Avatar
Olivier Masson
Bonjour,

Comment puis-je simplifier cette horreur ?
var x=1;
var y=1;

for (...) {
...
if (x == 1) {
if (y == 1) {
y = -1;
}
else {
x = -1;
y = 1;
}
}
else
if (y == 1)
y = -1
}

Le but étant d'avoir à chaque passage d'une boucle les coordonnées d'un
coin.
JS n'aimant pas avoir plusieurs instructions dans une condition de cette
forme : (x) ? (y=1;x=1) : x=0;

Merci.

1 réponse

1 2 3
Avatar
Dr J R Stockton
En fr.comp.lang.javascript <49212b02$0$946$,
Lun, 17 Nov 2008 09:27:45, SAM
id> a écrit:
Le 11/16/08 8:46 PM, Dr J R Stockton a écrit :
In fr.comp.lang.javascript message <492002c9$0$959$
fr>, Sun, 16 Nov 2008 12:23:52, SAM
invalid> posted:





Il est peut-être plus facile d'écrire de l'anglais quand on est
français que l'inverse ?



You write fairly good English; from what you say, Google does not write
anything like good French.

Pourquoi fait tr.voila.fr me donnent un message d'erreur
_in_bad_English_ ?!



Dites-le en anglais en précisant de quoi vous parlez ... pour voir.
Not understood ... what about are you talking?



"Why does tr.voila.fr give me an error message _in_bad_English_?!"

I think that it must be because some of the core of the system was
written in California by nerds.

tr.voila.fr : "Je crois qu'il doit être parce qu'un peu de coeur du
système a été écrit à Californie par les crétins."



I have a new problem : there are some French-Canadian web pages (not
hosted in the Netherlands) containing the original Latin and a
translation (probably a good one) into French. I'm trying to understand
the French well enough to express its essential meaning in English with
Algebra, then to put it into JavaScript. It is a great help that I know
exactly what the results of the JavaScript (only a few lines) should be.
I'm not likely to find anyone who understands Latin, English, simple
mathematics, and JavaScript. When I think I've finished, would you (or
someone else) care to look at it? The important thing is that, although
I use my existing knowledge to help me understand the French, my result
must express only what the originals say.

GOOGLE (et moi) : J'ai un nouveau problème: il ya des canadiens-français
pages Web (pas accueilli aux Pays-Bas) contenant l'original latin et un
traduction (probablement une bonne) en français. J'essaie de comprendre
le français assez bien pour exprimer l'essentiel de son sens en anglais
avec Algèbre, puis de le mettre en JavaScript. Il est d'une grande aide
que je connais exactement ce que les résultats de l'JavaScript
(seulement quelques lignes) devrait être. Je ne suis pas de nature à
trouver quelqu'un qui comprend le latin, l'anglais, simple
mathématiques, et JavaScript. Quand je pense que j'ai fini, vous (ou
quelqu'un d'autre) soins de la regarder? L'important, c'est que, même si
je utilise mon connaissance pour m'aider à comprendre le français, mon
résultat doit exprimer seulement ce que disent les originaux.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
1 2 3