Jump to content

Recommended Posts

Posted

I have been scratching my head for a while trying to think of an application for the following behaviour:

ConsoleWrite(Number('10 green bottles') & @LF) ; prints 10

I feel like I'm missing out on some secret information. I know it's been discussed previously, but in what context does this apply? - Got any ideas?

  • Moderators
Posted

czardas,

I remembered something about this a while ago, but the thread took some finding - enjoy.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

Same as in JS. Run inside your browser's console.

console.log(Number.parseInt ? Number.parseInt('10 orange') : window.parseInt('10 oranges'));

 

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Thanks Melba, I have just reread the thread. I couldn't remember its whereabouts. It's an interesting read. I think @jpm gave the most meaningful solution at the time: conversion to a double which fails all meaningful comparisons.

; and if 1 green bottle should accidentally fall
ConsoleWrite(Number('-1.#IND', 3) & @LF) ; this is fun :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...