OshaqHennessey

joined 2 weeks ago

Coding on mobile is hard

I'm glad you noticed. That was my favorite part too.

Yeah, it does look like C now that I think about it. You're right about the end result too. I believe C# will let you do inline declaration and assignment like that, so maybe that's what we're looking at? Been a while, could be wrong

[–] OshaqHennessey@midwest.social 2 points 4 days ago (4 children)

I just tested it in PowerShell. Works fine

$i = 1
$x = -$i
$x

Outputs -1

It's an incoherent hodgepodge of C#/.NET, PowerShell, and JavaScript, each of which I've forgotten more about than I currently know

[–] OshaqHennessey@midwest.social 63 points 4 days ago (4 children)
function myFunction() {
  try {
    x = new Random().nextInt();
    if (x != 10) {
     throw "not 10";
    }
    else {
      return (10)
    }
    catch(err) {
      myFunction()
    }
  }
}

x = myFunction()

Commit notes: Added error handling

[–] OshaqHennessey@midwest.social 5 points 4 days ago* (last edited 4 days ago) (2 children)
function foo() {
  x = new Random();
  case (x = 10):
    return (x);
  default:
    foo()
}
[–] OshaqHennessey@midwest.social 2 points 4 days ago (3 children)

Shit, you're right. x is declared inside the loop, so it doesn't exist until the loop begins execution.

Technically, I suppose you could say the compiler will allocate memory for x without assigning a value before the loop is executed and... I'm understanding what you mean now, I think.

view more: next ›