View Full Version : (2 += 2) = ?
Goodlookinguy
2008-09-29, 03:34 PM
6
That's it. Just 6. Or does it equal something else?
Does anyone not understand this?
I'm trying to get people thinking.
2 += 2 | 2 = 2 + 2 | Now, does that make sense?
I will state the answer in a moment.
Goodlookinguy
2008-09-29, 03:49 PM
0 ?
The answer was false.
Oh. I had seen (2+=2) .. which isn't even a problem.
Goodlookinguy
2008-09-29, 03:52 PM
Oh. I had seen (2+=2) .. which isn't even a problem.
Actually, in programing it is. You can use something like "variable += 1" which is the same as saying "variable = variable + 1"
Kazilla
2008-09-29, 04:04 PM
2 += 2 | 2 = 2 + 2 | OR
2 + x = 2 | 2 = 4 |
x = 0 | 2
x = 0/2
x = 0
false.
-Spector-
2008-09-29, 04:14 PM
| | Imply absolute value?
Goodlookinguy
2008-09-29, 04:22 PM
| | Imply absolute value?
No, I was not implying absolute value. I was just using "|" to separate my things.
Asamin
2008-09-29, 04:26 PM
2 += 2 | 2 = 2 + 2 | Now, does that make sense?
I will state the answer in a moment.
That was unfair. you added this info after D3V posted and made it so obvious that is is annoying.
Medieval Bob
2008-09-29, 04:27 PM
What exactly are you trying to ask?
The plus equals notation is invalid with a constant on the left. It just doesn't mean anything.
Goodlookinguy
2008-09-29, 04:41 PM
What exactly are you trying to ask?
The plus equals notation is invalid with a constant on the left. It just doesn't mean anything.
I already wrote the answer, "false."
(2 += 2) = false
Here's an easy one...
What is the output produced by this script?
x= 1;
for k= 8:-2:3
x= x+k;
disp(x)
end
Goodlookinguy
2008-09-29, 08:20 PM
Here's an easy one...
What is the output produced by this script?
x= 1;
for k= 8:-2:3
x= x+k;
disp(x)
end
This looks like, hmm, almost like BASIC language.
disp is a BASIC language trait.
Alright, this is not like a usual for statement, so I can't answer it. I also don't know BASIC language very well.
Lol, it's MATLAB, which is the only language I can write in besides Fortran.
Goodlookinguy
2008-09-29, 08:32 PM
Lol, it's MATLAB, which is the only language I can write in besides Fortran.
I'm telling you right now, MATLAB is based on BASIC. As are many other languages.
If you've ever messed with a TI calculator, the language used is called TI-BASIC, which is based on basic, and similar in syntax.
Anyways, that's neato, I'd never heard or seen that language used before. I think I might learn it just for the fun of it.
Random PHPness.
<?php
setSession();
if (!$_GET['kill']) {
if (!$_SESSION['test']) {
$_SESSION['test'] = 0;
}
else {
$test = $_SESSION['test'];
echo $test;
}
}
elseif ($_GET['kill']=="now") {
unlink($_SESSION['test']);
}
else {
// This will never appear
}
?>
I'm telling you right now, MATLAB is based on BASIC.
Thank you
Kazilla
2008-09-29, 08:51 PM
do
line (20,20)-(40,40); CLR:R
do loop while end keys = ""
something like that? Qbasic was so much fun sophomore year.
Goodlookinguy
2008-09-29, 09:00 PM
do
line (20,20)-(40,40); CLR:R
do loop while end keys = ""
something like that? Qbasic was so much fun sophomore year.
Yeah, something like that. BASIC is written line by line. MATLAB is broken by semi-colons which separates it from BASIC. However, it uses the same terms by which BASIC programs are built upon.
Also, just so everybody knows, BASIC is called BASIC for more than the words it stands for. It was made easy so that people could pick it up easily, but I always found it to be too loose.
vBulletin® v3.8.2, Copyright ©2000-2025, Jelsoft Enterprises Ltd.